Ngoc Nhu Quynh is known for her writing on deaths in police custody, environment and politics.

A dissident Vietnamese blogger known by the pen name "Mother Mushroom" was on her way to freedom in the United States on Wednesday after being released from prison where she was serving 10 years for anti-state propaganda, sources told AFP.

It is rare but not unheard of for political prisoners to be released early from jail in Vietnam, a one-party state whose conservative leadership has waged a brutal crackdown on critics over the past two years, drawing ire from Western allies and rights groups.

But Nguyen Ngoc Nhu Quynh's release came as US Defense Secretary Jim Mattis visited Vietnam, which has been keen to build ties with its old foe Washington as it nervously eyes the rise of its giant northern neighbour China.

Mother Mushroom -- a name that came from her daughter's nickname was "mushroom" -- became one of Vietnam's most outspoken critics before she was put behind bars in 2017, thanks to her writing on the taboo topic of deaths in police custody, the environment and politics.

She was freed from jail Wednesday and put on a flight to the United States, an American embassy source, friends and a Vietnam official told AFP.

"Quynh was sent to the US earlier today," a Vietnamese government official confirmed to AFP, speaking on condition of anonymity.

Family friend Nguyen Lai said "congratulations" on Facebook to Quynh, adding she would soon be in a "free country" with her two children and mother.

Mother Mushroom was arrested in October 2016 after visiting a fellow activist in prison -- but even from jail she remained steadfast in her opposition to the communist government.

Her family told AFP she held several hunger strikes, most recently in July when she stopped eating for two weeks, according to the 88 Project, a political prisoner watchdog.

Earlier this year she was moved from a jail in her home province of Khanh Hoa to a prison hundreds of kilometres away, a move her relatives objected to because it made it harder to visit her.

Officials did not give a reason for relocating her, but her family feared it was to punish her, they told AFP.

Cause celebre

Former US ambassador to Vietnam Ted Osius, who had protested the length of her sentence, welcomed the news of her release.

"I'm delighted that she's out of jail, I know she was ill and I know her family has been terribly worried about her," he told AFP.

Quynh became a cause celebre and received an International Woman of Courage Award in 2017, presented to her in absentia by US First Lady Melania Trump.

Months later, Quynh's young daughter penned an emotional letter to Mrs Trump appealing for her mother to be freed.

The release coincided with Mattis' trip, the second visit he has made to Vietnam.

US President Donald Trump's administration has previously come under criticism for putting issues of free expression and human rights on the back-burner, especially in Vietnam.

Trump's predecessor Barack Obama met with several civil society activists and journalists when he visited Vietnam in 2016.

During his own visit last year Trump noticeably failed to publicly mention rights, instead focusing on the trade deficit and urging Hanoi to buy more American goods.

Observers have drawn links between Trump's apparent blind spot on rights issues and Vietnam's most recent crackdown on critics, which picked up pace in 2016 when a new conservative leadership came to power.

At least 55 activists have been jailed this year alone, including several handed steep prison sentences of up to 20 years in prison.

One of those dissidents, Nguyen Van Dai was secretly released in June and put on a plane with his assistant to Germany.

Dai, who co-founded the Brotherhood for Democracy human rights network, had been sentenced to 15 years in jail for attempting to overthrow the government. His assistant Le Thu Ha has been sentenced to six years.

Vietnam has released other high-profile dissidents in the past, usually in cooperation with foreign governments, and they are almost always sent abroad with the understanding that they are not welcome back.