A Chinese medical student who murdered his roommate at a prestigious Shanghai university by poisoning a drinking water dispenser was executed Friday, the official Xinhua news agency reported.

Lin Sinhao was convicted by a Shanghai court of murdering fellow student Huang Yang "out of spite" by spiking a water dispenser with the toxic chemical N-Nitrosodimethylamine in April 2013.

He was put to death after failing in a series of appeals, and met members of his family before being executed, Xinhua said.

Shortly after his execution was announced, state broadcaster CCTV aired an interview with him in which he expressed remorse on camera and said his death would mean "paying off the debts".

"I owe a lot to Huang Yang's parents. I wish I could do something to compensate them and wish they can continue their life in a healthy and positive manner," Lin said.

"I should take responsibility for what I did."

The supreme court said Lin's action was "abominable" and his crime "extremely severe" as he knowingly used a hazardous chemical to poison the victim and intentionally concealed the fact during Huang's two weeks of hospital treatment, Xinhua said.

N-Nitrosodimethylamine is primarily used for research. Exposure in humans may cause liver damage and affect the blood, according to the US Environmental Protection Agency.

The crime drew comparisons in China to a 20-year-old case in which a student studying at Tsinghua University in Beijing was allegedly poisoned with thallium by a classmate in 1994 when the two were studying chemistry.

The victim in that case, Zhu Ling, remains alive with severe brain damage. The suspected poisoner -- who was said to be related to a senior Chinese official -- was never tried and later moved abroad.

The US-based rights group the Dui Hua Foundation estimates that China put 2,400 people to death in 2013.

The figure was a fraction of the 12,000 in 2002, but Beijing considers the statistic a state secret, and is so reticent on the issue that it has not publicised the long-term decline in its use of the death penalty.

It still executes more people than the rest of the world put together, rights groups say.