Air Canada said Flight AC 090 took off for Sao Paolo at around 11:30 p.m. Wednesday, unaware that a male passenger had boarded the aircraft without proper screening.
"With the aircraft already in the air for four hours, we were notified of this and ordered by Transport Canada to have the aircraft return to Toronto," Air Canada spokesman Peter Fitzpatrick said in an email.
The plane landed at 6:30 a.m. at Pearson and was surrounded by police and security officials.
"Police came on board and got a man," Canadian basketball coach, Chantal Vallee, who was on the flight, said in a tweet.
"We were told he got on the plane without passing through security and got caught on tape. I see him in the boarding area now!?"
Airport authorities had said late Wednesday that all departing international flights from Terminal 1 were suspended while police searched for a man who had passed through security unchecked.
The Air Canada flight had apparently just taken off when the flights were grounded. It was not clear what the cost of the diversion was.
Peel regional police said Thursday they were called to the airport for a "security breach" to try to identify the man who had triggered the alert by walking into a supposedly secure area of the airport without going through the proper checkpoints.
Using surveillance footage, they were able to determine he had boarded the Air Canada flight.
Officers interviewed him on the plane's return to Canada.
"We found there was no criminality involved and that was pretty much it," Const. George Tudos said.
"At that point, he was allowed to reboard."
Police would not release any details about the person and referred questions about the breach to the Greater Toronto Airports Authority and Transport Canada, which refused to discuss what occurred.
"Transport Canada recalled the plane," the agency wrote in a statement. "For security reasons, we cannot disclose the reasons behind this decision."
It referred further requests for information to the Greater Toronto Airport Authority, which in turn issued a statement about an unspecified "security breach" and said it would do an internal assessment.
"In the interim, enhanced security measures have been put in place," the authority statement said. "Given the incident involves airport security, we cannot share specific details."
The flight departed again for Brazil mid-morning Thursday.
"Yeah!! Boarding now back to Sao Paulo!" Vallee tweeted.
"I think that will mean 18 hours of flying in 24 hours."
Vallee said she thought Air Canada handled the situation well.