Updated

Sri Lanka's former army chief, who was imprisoned after losing an election to President Mahinda Rajapaksa, was released from prison Monday to thousands of cheering supporters.

As firecrackers erupted in the background, Sarath Fonseka promised to carry on with his challenge to the government.

"I will sacrifice my life to serve the people of this country. Even if they put me in prison for 10 years, I will not stop performing my duty," he said.

Fonseka's release came after Foreign Minister G.L. Peiris met with U.S. Secretary of State Hillary Rodham Clinton on Friday in Washington, with the protection of human rights highlighted in their meeting. The U.S. has called Fonseka a political prisoner.

Fonseka had been credited with leading Sri Lanka's army to victory in the country's long and bloody civil war against ethnic Tamil rebels. But he was jailed after challenging Rajapaksa in 2010 elections.

Fonseka was court-martialed on several charges related to his military service. Fonseka said the cases were a political vendetta by Rajapaksa. The government denied the accusation.