The pilot of a hijacked Air Mauritania plane deliberately made a rough landing so passengers and crew could tackle the gunman, Spanish officials say.
Police arrested a man after the plane landed in the Canary Islands
He tipped off passengers about the plan after realising the hijacker spoke no French, one official told AP agency.
The hijacker was overpowered after being knocked over as planned during the landing in Spain's Canary Islands.
Mauritanian police are investigating how the hijacker boarded the Boeing 737 with two loaded handguns.
The gunman seized the jet soon after take-off from the capital, Nouakchott, and demanded to be flown to France to seek asylum, officials say.
One report said a gun was held to the pilot's head during the hijack.
But as the pilot approached Gando military base near Las Palmas international airport, he used the plane's intercom system to tell passengers in French of his plan, said AP quoting a Spanish official.
"The pilot and his colleagues decided to abruptly apply brakes on landing to throw off-balance the hijacker, who was hurled to the floor by the jerk and was quickly overpowered before being handed over to the Spanish police force," a Mauritanian official told AFP news agency.
One report said flight attendants threw boiling water at him and around 10 people overpowered him.
The pilot, named by Air Mauritania as Ahmedou Mohamed
Lemine, had urged crew members and men to sit in the front rows, ready to act, while women and children were warned to move to the rear, AP said.
Spanish officials say the lone hijacker was a 32-year-old Mauritanian, but Mauritania disputes this.
Seventy-one passengers - mostly Spaniards and Mauritanians - and eight crew were on the plane, reports from Spain said.
Twenty-one passengers were injured in the incident, including a pregnant woman who was treated for severe shock.
The jet returned home on Friday and the crew members were given a heroes' welcome.
Mauritania's President Ely Ould Mohamed Vall also returned home on Friday following the incident. He had been expected to stay at a summit in the south of France until Saturday.
The hijacked plane took off from the north-west African nation in the late afternoon on Thursday.
It tried to land at Dakhla, in Western Sahara, but Moroccan authorities refused permission, security officials said.
The plane was due to stop over in the northern Mauritanian port of Nouadhibou, before continuing to Gran Canaria, in Spain's Canary Islands.
In 1998 an armed hijacker commandeered an Air Mauritania jet, demanding to take it to Morocco.
He also was overpowered by the pilot and there were no casualties in the incident.