Sarath Fonseka, Sri Lanka's former army chief, has has been released from prison after President Mahinda Rajapaksa granted him a pardon, coinciding with the third anniversary of the island nation's victory over Tamil separatists.

"I am free. I will devote my life for my people," Fonseka said on Monday as he emerged from Welikada prison in the capital, Colombo.

His freedom comes more than two years after he was jailed on corruption charges following an unsuccessful bid to unseat the president in 2010.

Rajapaksa was under international pressure to release his highest-profile rival.