HANOI, Vietnam — Vietnam has freed a well-known blogger after two years in prison on the condition that she leave for the United States.

Nguyen Ngoc Nhu Quynh, known as "Mother Mushroom," was arrested in October 2016 and sentenced to 10 years in prison on charges of defaming the Communist government. The conviction of the popular blogger, who wrote about human rights and industrial pollution, drew criticism from some Western governments and international human rights groups.

Friends of the 39-year-old blogger said she was on her way to the U.S. with her mother and two young children.

"After numerous efforts, the family of Nguyen Ngoc Nhu Quynh was reunited in a free country," her friend Nguyen Tin wrote on his Facebook page. "Congratulations to her small family."

Quynh's lawyer, Ha Huy Son, said her release was good news but did not lift the obstacles faced by people who fight for democracy in Vietnam.

Nicholas Bequelin, Amnesty International's Regional Director for East and South East Asia, said in a statement, "While Mother Mushroom is no longer imprisoned, the condition for her release was exile and there are over one hundred people languishing in jail because they peacefully spoke their mind — in public, on blogs or on Facebook."

In June, Vietnam's Communist authorities released prominent human rights lawyer Nguyen Van Dai and exiled him and another dissident to Germany.

Quynh's release came as U.S. Secretary of Defense Jim Mattis visited Vietnam.

Meawhile, a court in southern Binh Duong province sentenced an activist to seven years in prison on Wednesday after finding him guilty of producing 3,300 leaflets calling on workers to protest against a proposed law on special economic zones.

Nguyen Dinh Thanh, 27, was convicted of conducting propaganda against the state in the one-day trial.

Protests took place across the country in June against the proposed law, which critics say would favor Chinese investors. The government has since delayed passage of the law by the National Assembly.

Vietnam has stepped up a crackdown on dissent over the past two years with dozens of activists and bloggers put on trial for national security law-related offenses.

Despite sweeping economic reforms since the mid-1980s that opened Vietnam to foreign investment and trade and made it one of the fastest-growing economies in Asia, Communist authorities tolerate no challenge to their one-party rule.

There are more than 100 "prisoners of conscience" in Vietnamese prisons, according to Amnesty International.

Follow NBC Asian America on Facebook, Twitter, Instagram and Tumblr.