Sri Lanka's new president has pardoned and reinstated the rank of an ex-army commander who was imprisoned four years ago after challenging the former president in an election.

President Maithripala Sirisena's office said Sarath Fonseka is now entitled to enjoy all of his former privileges without any legal obstacles.

Fonseka — Sri Lanka's only four-star general — is credited with leading the army to victory in the country's long civil war with ethnic Tamil rebels.

He was jailed after challenging then President Mahinda Rajapaksa in the 2010 election in a move widely condemned as political retribution by Rajapaksa. Sirisena defeated Rajapaksa in the Jan. 8 presidential election.