Meghan, Duchess of Sussex. Photo: Yui Mok/AP

A women's rights activist who befriended Meghan Markle at a global conference is facing a long jail sentence in Saudi Arabia.

Loujain Al-Hathloul, 28, has allegedly confessed to conspiring with enemies of the Middle Eastern kingdom and could be imprisoned for treason, human rights monitors warned. Treason can carry a 20-year sentence – or even the death penalty.

Miss Al-Hathloul met Meghan, now the Duchess of Sussex, two years ago when they attended a humanitarian summit in Ottawa, Canada.

A photograph showed her posing beside a river with the American actress, who only a month later was revealed to be dating Prince Harry. Other pictures, taken for Vanity Fair, show the pair with former Irish president Mary Robinson and writer Fatima Bhutto, a member of the Pakistani political dynasty.

The One Young World summit was also attended by Harry Potter star Emma Watson and Canadian prime minister Justin Trudeau.

Writing at the time, Meghan praised activists who had spoken out about human rights violations, gender equality, discrimination and injustice, saying: ‘They are the change.’

Miss Al-Hathloul studied in Canada but continued to campaign for women to have the right to drive in Saudi Arabia. She was held in prison for 73 days in 2014 after she defied the driving ban. She later received a royal pardon and claimed her jailers told her that Prince Charles had raised her case during a meeting with Saudi ruler King Salman.

FILE - This Nov. 30, 2014 image made from video released by Loujain al-Hathloul, shows her driving towards the United Arab Emirates - Saudi Arabia border before her arrest on Dec. 1, 2014, in Saudi Arabia. The arrest of 10 women’s rights advocates, including Al-Hathloul, just weeks before the kingdom is set to lift the world’s only ban on women driving, on June 24, is seen as the culmination of a steady crackdown on anyone perceived as a potential critic of the government. Al-Hathloul in her late 20s is among the most outspoken women’s rights activists in the kingdom. (AP Photo/Loujain al-Hathloul, File)

The driving ban was lifted, leading to hopes that other restrictions on women would be eased, such as the repressive male guardianship system which requires women to get their male relatives’ permission to get a job, marry or even travel abroad.

But in March Miss Al-Hathloul was stopped in Abu Dhabi and flown back to Saudi Arabia, where she was banned from leaving the country or using social media.

Two months later, she was among five women and two men detained by the Saudi authorities. Human rights group Amnesty International said the detainees are alleged to have confessed to communicating with the kingdom’s enemies.

They were also said to have admitted ‘providing financial and moral support to hostile elements abroad’.

Reports have claimed they were arrested for speaking to foreign media about women’s rights.

They are expected to go before a court that was set up to deal with terrorism suspects but which has increasingly been used for cases related to human rights activism.

Kareem Chehayeb, a Middle East-based researcher for Amnesty, said: ‘They have been arrested purely based on their women’s rights activism and these are trumped up charges for which they could get 20 years in jail.’ He said little was known about the conditions in jail or whether they had been allowed access to lawyers.