Image copyright Reuters Image caption She was afraid for her life and Twitter came to her rescue

On the evening of Saturday, 5 January, a desperate situation began to unravel on a newly created Twitter account.

Fleeing her Saudi family in Kuwait, Rahaf Mohammed al-Qunun, 18, sent out a series of tweets pleading for help from an airport hotel room in Bangkok.

At the time she had 24 followers.

"I'm the girl who ran away to Thailand. I'm now in real danger because the Saudi embassy is trying to force me to return," her first-ever tweet in Arabic read.

Then she said something that would be hard to ignore: "I'm afraid. My family will kill me."

People noticed and the first tweet with the hashtag #SaveRahaf was sent out.

Within minutes of that, Egyptian-American activist Mona Eltahawy translated the Arabic tweets into English and sent it to her hundreds of thousands of followers.

A few hours later that tweet caught the attention of Human Rights Watch and eventually Phil Robertson, its Bangkok-based Asia deputy director, who sent this out.‏

By the early hours of Sunday he was engaged in a direct Twitter message exchange with Ms Mohammed al-Qunun, guiding the young woman in her dealings with authorities at the airport.

#SaveRahaf

Despite that she kept up her barrage, live tweeting every minute of her ordeal and putting out videos that showed everything that was happening to her at the airport. Over the course of Sunday, her posts became more and more fevered.

The fear and desperation she conveyed through the tweets drew sympathy and support from the Twitter community.

Tweets carrying the #SaveRahaf hashtag continued to gain momentum and by mid-Sunday afternoon, it was in more than half a million tweets, according to Twitter.

An unknown teenager from Saudi Arabia that no-one had ever heard of had gone from 24 followers to more than 27,000 in the span of less than 24 hours.

Media playback is unsupported on your device Media caption The story of Rahaf Mohammed al-Qunun

"When I heard Rahaf Mohammed al-Qunun's public statement that she renounced her religion, I knew things would go very bad for her if she was sent back to Saudi Arabia," Human Rights Watch's Phil Robertson told BBC News.

"At that point, there was no question in my mind - she needed our help."

Renouncing Islam, or apostasy, is a crime punishable by death in Saudi Arabia.

The movement to help Ms Mohammed al-Qunun's life gathered huge momentum, particularly in Australia, where her case is now being referred to for possible resettlement.

"Twitter aims to provide a platform where marginalised voices can be seen and heard. This is fundamental to who we are and crucial to the effectiveness of our service," an official statement to the BBC read.

This is where it gets dramatic

On Monday morning, the situation took a turn for the worse, with the arrival of Thai immigration authorities at Ms Mohammed al-Qunun's hotel room to deport her to Kuwait.

Following their direct message exchange on Twitter, Ms Mohammed al-Qunun heeded the advice of Human Rights Watch not to surrender her mobile phone under any circumstances.

And it proved to be a crucial piece of advice.

The frantic teenager barricaded herself in with Australian journalist Sophie McNeill, refusing to board the flight. Instead, she relentlessly continued documenting the ordeal on Twitter.

After that her followers doubled in number to more than 66,400.

The BBC's South East Asia correspondent Jonathan Head, who was part of a network of foreign journalists closely charting Rahaf Mohammed al-Qunun's case, said the enormous publicity driven by social media was a big factor in what happened to her.

"Rahaf Mohammed al-Qunun was a frightened, young woman. Interest in Rahaf's plight drove her own Twitter following up by the time Thai authorities planned to deport her on Monday morning.

"This was a very powerful human story happening in real time, whose ending was uncertain."

"In building support and response to crisis situations, Twitter was the perfect social media tool for Rahaf Mohammed al-Qunun because it enabled the rapid sharing of information," Phil Robertson added.

"The surge of support on Twitter [not only] caught the attention of reporters and editors, it helped engage the mainstream Thai media.

"Her tweets also attracted attention from local diplomats as well as the highest levels of UNHCR and governments to the situation.

"This was all pivotal in prompting Thailand to re-think their approach once it was clear that Rahaf Mohammed al-Qunun would not go quietly."

"As of Sunday night Thai officials were adamant she would be sent back and Thai media had still not reported the story, by Monday morning that had changed," said the BBC's Jonathan Head.

Today Ms Mohammed al-Qunun is safe, having been declared a legitimate refugee by the UN.

Image copyright AFP Image caption Rahaf Mohammed al-Qunun flanked by immigration and UN officials at Bangkok's airport

Young and social-savvy, Rahaf Mohammed al-Qunun was able to take things into her own hands by successfully mobilising a solid online campaign to protect herself.

She has come out of this ordeal with 126,000 followers on Twitter in the five days her account has been active.

In another case where social media was used in a similar way a Syrian man stranded at a Malaysian airport for months managed to successfully seek asylum in Canada after campaigning for his cause on Twitter and Facebook.

But not everyone facing a threat to their life has been as lucky.