HONG KONG — A Chinese journalist and democracy advocate who had been imprisoned since 2005 after Yahoo provided information about his e-mail account to the government in Beijing has been released, his associates said Saturday.

The journalist, Shi Tao, who worked in the central city of Changsha, was arrested by the Chinese authorities in 2004 for leaking “state secrets” abroad and was sentenced to a 10-year prison term in April 2005. He had used his Yahoo e-mail account to send messages to an online forum, based in New York, about a Chinese propaganda directive censoring domestic news media coverage of the 15th anniversary of the 1989 Tiananmen Square massacre.

Mr. Shi, who is also a poet, was released from a prison in the city of Yinchuan, in the northwest Ningxia region, on Aug. 23, Zhang Yu, the deputy secretary general of the Independent Chinese PEN Center, part of the PEN International organization of writers, said Saturday. Mr. Shi is now staying with his mother in Yinchuan, and in phone conversations over the past week he said he “felt generally well,” according to Mr. Zhang.

It was not immediately clear why Mr. Shi, who had served less than nine years, had been released before the completion of his sentence. He was transferred to Yinchuan from a prison in central Hunan Province in 2010.