By Sarah Rainsford
BBC News, Lanzarote airport
Aminatou Haidar looked weak, but was smiling, ahead of her flight home
Aminatou Haidar finally boarded a plane home to Western Sahara late on Thursday night after 32 days on hunger strike at Lanzarote airport.
The independence activist launched her very public protest after the Moroccan authorities confiscated her passport and denied her entry to Laayoune, in the disputed territory of Western Sahara.
She had refused to declare her nationality as Moroccan on an official form - as usual - but this time she was expelled from the territory.
Mrs Haidar spent the next month camped out at Spain's Lanzarote airport surrounded by an ever-increasing group of supporters.
As rumours began to spread that the crisis had been resolved, an excited crowd gathered outside the local hospital.
There were whistles and cheers as the long-time human rights campaigner emerged in a wheelchair, shortly before 2200 local time. Shading her eyes from the glare of dozens of camera lights she looked weak, but was smiling.
"This is a triumph, a victory for human rights, for international justice and for the cause of Western Sahara," Mrs Haidar told the crowd in a near whisper. "And it's all thanks to your pressure."
Mrs Haidar slept in a room at the airport surrounded by supporters
The situation had become serious in the early hours of Thursday morning, when Aminatou Haidar admitted herself to hospital.
She had been unable to swallow liquid for two days, was nauseous and suffering stomach cramps. Still she refused to break her fast, vowing that she was prepared to die for her right to return home.
It now appears that frantic multi-country talks were under way to seek a resolution.
Mrs Haidar, who is a renowned advocate of the rights of the Saharawi people, had been highly critical of the Spanish government.
She accused politicians in Madrid of failing to compel Morocco to allow her home.
Her cause was taken up by celebrities including film director Pedro Almodovar and actor Javier Bardem. It became front-page news in most Spanish newspapers, most days.
'Accept the consequences'
Under pressure, the Spanish government insisted it was doing everything possible.
Mrs Haidar rejected its offer of refugee status or Spanish nationality in order to travel, saying she refused to be a foreigner in her own land.
The position of Morocco - which took control of Western Sahara three decades ago, but whose sovereignty there is not internationally recognised - remained firm.
The foreign minister announced that Aminatou Haidar had rejected her citizenship and must accept the consequences.
As she prepared to board the plane in Lanzarote, details of how a deal was finally reached were not known.
The Spanish foreign ministry said only that it was the result of a co-ordinated effort between Spain, France and the US to persuade Morocco that it would be '"preferable" to allow Mrs Haidar back to Western Sahara.
A spokesperson told the BBC no conditions were attached and Spain had issued "salvoconducto" (safe-conduct) documents to make travel possible.
'Move the world'
So, at about 2230, the activist's friends and supporters rushed to a wire fence at the airport edge to wave her off.
Young Saharawi men clambered on to a flimsy roof, jumping for joy and waving banners; there were triumphant hugs, loud cheers and a few tears.
"Wow! I feel great," said Cristina Martinez, from Madrid, with a huge grin. She had slept rough for more than 20 days in the car park of Lanzarote airport, alongside Mrs Haidar, in solidarity.
"You can't imagine day after day what it was to see her suffering that way. But it's so impressive that a woman on a hunger strike can move the whole world!"
A crowd of supporters in the airport car park celebrated the departure
Describing Mrs Haidar as a very determined, strong woman, Mrs Martinez said she felt Spain had a moral duty to help the Saharawi people, in what was a Spanish colony until 1975.
If Morocco expelled Mrs Haidar in order to end her human rights activism in Western Sahara, that attempt appears to have backfired.
"I hope this alerted the whole world to the plight of Western Sahara," said Marselha Margerin, from the Robert Kennedy Center in the US, which recognised Mrs Haidar's campaign work with an award last year.
"The last colony in Africa has been waiting 34 years for its independence, or for its final status - which the Saharawi people should be able to decide."
As she spoke, the plane carrying Aminatou Haidar home to her children took off into the night sky, leaving a crowd of supporters in the airport car park - to celebrate late into the night.