A.G. Perarivalan, who was jailed over the assassination of former prime minister Rajiv Gandhi, speaks to the media outside his home in Chennai on May 18.
New Delhi CNN  — 

India’s top court on Wednesday granted the release of a man convicted of killing former Indian Prime Minister Rajiv Gandhi, 31 years after his imprisonment.

The Supreme Court invoked extraordinary powers to release A. G. Perarivalan, his attorney told CNN.

Perarivalan was arrested a few weeks after Gandhi was assassinated in a suicide bomb attack on May 21, 1991, in the southern state of Tamil Nadu.

The attack was blamed on separatist rebels fighting for a Tamil state in Sri Lanka. Gandhi’s killing was seen as retaliation for his decision to send Indian troops into Sri Lanka in 1987 to enforce a peace accord to end the island nation’s civil war.

Perarivalan, who was 19 years old at the time of the attack, was accused of buying batteries for the bomb. He was convicted of criminal conspiracy to commit murder, among other charges, court documents show.

He was sentenced to death in 1998 alongside six others, but his sentence was reduced to life imprisonment in 2014.

A.G. Perarivalan, who was jailed over the assassination of former Prime Minister Rajiv Gandhi, outside his home in Chennai on May 18.

In 2015, Perarivalan’s attorney K. Paari Vendhan filed a mercy plea, which was referred to Tamil Nadu’s governor. Vendhan later filed an application for bail to the Supreme Court, after failing to receive a response from the governor for years.

In March this year, the Supreme Court granted Perarivalan bail for his “conduct during his long incarceration,” the educational qualifications he obtained in jail, and his “ill health,” according to court documents. The court heard the governor had referred the mercy plea to India’s President Ram Nath Kovind.

On Wednesday, the Supreme Court ruled it would release Perarivalan, rendering his sentence complete under a constitutional provision that allows the court to pass an order when a case is held up. The court found the governor did not have the power to refer the mercy plea to the president and had failed to respond to the plea, Vendhan said.

Tamil Nadu’s Chief Minister M.K. Stalin on Wednesday tweeted a video of him meeting and embracing Perarivalan after his release.