By Chris Fuchs

A U.S. citizen arrested in Vietnam while taking part in a demonstration last month has been released from custody and is with his family, the State Department confirmed to NBC News on Friday.

Will Nguyen, 32, was arrested on June 10 by police in Ho Chi Minh City, where he was taking part in protests against the Vietnamese government’s plans to establish special economic zones that demonstrators feared would be dominated by Chinese interests.

A Vietnamese court on Friday convicted Nguyen of disturbing public order and ordered him deported, according to The Associated Press. He had faced up to seven years in prison.

A court official said Nguyen, who is of Vietnamese descent, was given a lenient sentence because he admitted to the violation and showed remorse, The AP reported.

A college friend of Nguyen, Kevin Webb, said in a phone interview Friday morning that Nguyen had already left Vietnam by plane with his family, who had attended the trial. Nguyen's mother and sister, Victoria, were with him, he said.

They were en route to Singapore, Webb said, where Nguyen lives and graduated this month from a master’s program in public policy at the University of Singapore.

“The family is over the moon,” Webb said, adding, “They’re absolutely delighted to get him out of the country."

Secretary of State Mike Pompeo raised Nguyen’s case with Vietnamese officials during his visit to the communist country on July 9 and encouraged a speedy resolution, according to the State Department.

Will NguyenCourtesy of Mary Daniel

Nguyen, a Yale graduate who was born and raised in Houston, had stopped in Vietnam for a short vacation. Mary Daniel, a friend of Nguyen, has said he joined the June 10 protest “out of support for the Vietnamese people.”

Those country-wide demonstrations came amid concerns that a controversial proposal on special economic zones, in which land could be rented for up to 99 years, would benefit Chinese investors, according to The AP.

Vietnam’s National Assembly voted to put off the legislation until the next session in October to allow for more research.

Six Vietnamese have been sentenced to up to two-and-a-half years in prison for the protest and more are awaiting trial, The AP has reported.

Nguyen’s family and friends alleged in a statement issued after his arrest that Nguyen had been “beaten over the head and dragged into the back of a police truck” after police tried to clear the protests.

A video uploaded to YouTube that accompanied the statement appears to show Nguyen, bleeding from his head, being dragged by a group of men. Nguyen can later be seen standing on the bed of a police truck as it drives off.

The Vietnamese state-run Tuoi Tre newspaper, quoting from the indictment, said Nguyen was accused of calling on other protesters to overrun police barricades as they marched from a park near the city’s international airport to the city center, The AP reported.

Nguyen allegedly climbed into one of four police pickups, which were used to block a road, and urged others to climb over the vehicles to continue their march, the indictment said. His actions “seriously violated public order and badly affected security order, social safety and needs to be dealt with seriously,” it alleged.

A little more than a week after being arrested, Nguyen reportedly confessed on state television in Vietnam, saying that he regretted breaking the law and that he will stay away from future rallies, according to Agence-France Presse.

Webb previously said Nguyen’s friends and family believe the statement was coerced and staged, based on the way he was speaking.

A number of U.S. elected officials became involved in Nguyen’s case, sending off letters to Pompeo, Vietnam’s ambassador to the U.S. and President Donald Trump.

Most recently, 19 House and Senate members, led by Rep. Jimmy Gomez, D-Calif., sent another letter to Pompeo on July 18 asking him to take additional action to secure Nguyen’s release.

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