TORONTO -- An Air Canada flight bound for Toronto from Madrid has landed safely after declaring an emergency shortly after take-off.

Air Canada flight 837 departed from the Adolfo Suarez-Barajas international airport earlier in the day. It was expected to land in Toronto at 3:40 p.m.

In a statement to CTV News Toronto, Air Canada said the plane experienced an engine issue shortly after take-off. There were 128 passengers and eight crew members on the plane, none of which were injured in the incident.

Air Canada said the pilot opted to return to Madrid and circled to "use up fuel and lighten the aircraft for landing".

Update: 'We were in trouble': Toronto woman feared for life during Air Canada flight emergency

"The aircraft, a Boeing 767-300, is designed to operate on one engine and our pilots are fully trained for this eventuality," Air Canada said.

Flight-tracking website Flightradar24 shows the aircraft, which took off at about 3 p.m. local time, circling the airspace above Madrid for four hours.

A spokesman for Enaire, Spain's air navigation authority, said the plane's landing gear did not fold up properly after taking off and that a piece of it may have damaged part of one of the engines. The officials were not authorized to be named in media reports.

Benoit Gauthier, a retired Air Canada pilot who flew for 37 years, said the tire rupture and engine problem are "most likely" connected.

"When a tire ruptures on takeoff, there's always a remote chance that it explodes and some part of the rubber ends up in the engine," he said in a phone interview.

The engine problem likely triggered the return to airport, while using up fuel made for a lighter load on a plane that lacks the full power of its second turbine, he said.

"If you've lost an engine, you don't want to cross the Atlantic. You want to land," Gauthier said.

Spain's Defence Ministry said that an F18 fighter jet had been dispatched from a military airport near the Spanish capital to evaluate the damage done to the landing gear of the flight.

Air Canada flight #AC837, Madrid to Toronto, has landed safely at Madrid airport, having returned due to an engine issue.

//

Le vol Madrid–Toronto #AC837 d’Air Canada s’est posé en toute sécurité à l’aéroport de Madrid après qu’un problème de moteur ait forcé son retour. — Air Canada (@AirCanada) February 3, 2020

Meanwhile, Madrid residents posted videos online showing a plane flying unusually low over the Spanish capital's centre and suburbs.

It was the second incident of the day at Madrid's international airport, the busiest in the country. Earlier on Monday, the airport closed for over an hour due to the reported sighting of drones in the vicinity.

Air Canada said customers will be provided hotels and rebooked onto other flights.

With files from The Canadian Press