HANOI : A Vietnamese court on Friday overturned a six-year jail term handed to a student activist, freeing her on the spot in a rare show of leniency by the authoritarian nation.

The verdict which freed 21-year-old Nguyen Phuong Uyen on appeal was so unexpected -- Vietnam's courts routinely reject pleas by anti-state dissidents against their lengthy sentences -- that her mother fainted, reports said.

Uyen was sentenced in May to six years in prison for distributing anti-state propaganda, prompting an outcry from Vietnamese social media users and international rights groups.

"She was freed at the court," lawyer Nguyen Thanh Luong -- who does not represent Uyen but attended the proceedings -- told AFP.

Uyen was instead handed a three-year suspended sentence, he said.

Uyen's co-defendant, 25-year-old computer technician Dinh Nguyen Kha, who was jailed for eight years at their trial in the southern province of Long An, had his sentence halved by the appeal court Friday.

"It's amazing she's walking free," Phil Robertson, of the Asia Division of Human Rights Watch, told AFP, adding that the verdict "defied expectations".

"Maybe the Vietnamese government is finally getting the message from (US President Barack) Obama and others that they have to improve their record on human rights," he said.

Uyen -- who refused legal representation for the appeal hearing -- reportedly told the court she was a patriot and not a criminal.

"Opposing the (ruling) Communist Party does not mean opposing the country and the people," she said, according to an unofficial transcript of proceedings posted online by activists.

Prosecutors had originally suggested a minor reduction of the jail terms but later changed their proposal without explanation, as is common within the communist country's opaque legal system.

Observers said the surprise move was likely a result of the involvement of Vietnam's top leadership.

The pair were accused of distributing anti-government leaflets which "humiliated the administration" and called for demonstrations against the regime.

The charges -- under Article 88 of the criminal code -- carry a maximum sentence of 20 years in jail and are routinely laid against dissidents.

Scores of activists have been jailed in the last few years for anti-state activity in Vietnam, where the Communist Party forbids all political debate.

This year, at least 46 activists have been convicted on similar charges, and at least three bloggers were detained in June alone, all accused of anti-state activity.

The country has recently revealed a sweeping new Internet law which will ban bloggers and social media users from sharing news stories online, in a move seen as a further crackdown on online freedom.

Vietnam bans private media and all newspapers and television channels are state-run.