BEIJING — Chen Shui-bian, a former president of Taiwan who is serving a 20-year prison sentence for corruption, tried to kill himself on Sunday, the Ministry of Justice said in a statement.

Mr. Chen, 62, tried to commit suicide with a towel in a shower in Taichung Prison, but he was treated quickly and did not appear to have any “significant condition,” the statement said.

Mr. Chen, who served as president from 2000 to 2008, was convicted in 2009 on graft charges, including receiving $20 million in bribes and misusing public money. He was given a life sentence, which was later reduced on appeal. His wife, Wu Shu-chen, was also convicted of graft charges.

During his two terms in office, Mr. Chen supported independence from China, angering the Chinese government. China considers Taiwan, which has been autonomously governed since 1949, a part of its territory that must eventually be reunited.