(CNN) -- China "resolutely opposes" a planned trip by the Dalai Lama to Taiwan, the official Chinese news agency Xinhua reported Thursday, hours after Taiwan's president announced the visit.

The Dalai Lama's visit to Taiwan could anger China, which accuses him of advocating independence for Tibet. more photos »

Beijing opposes the visit "in whatever form and capacity," a spokesman for the State Council Taiwan Affairs Office said, according to Xinhua, which did not name the spokesman. "Under the pretext of religion, (the Dalai Lama) has all along been engaged in separatist activities," he said.

The Tibetan leader's spokesman denied there was any political subtext to the visit.

"His holiness has received an invitation from several mayors inviting him to Taiwan. He has accepted for the sole purpose (of expressing) his condolences and to share his sorrow for Taiwan's people," Tenzin Taklha said, calling the visit "completely... non-political."

Taiwan President Ma Ying-jeou said earlier Thursday that he had approved a visit by the Dalai Lama to pray for the victims of the typhoon-battered island.

Ma made the announcement Thursday while visiting a school in the southern part of the country, a government spokesman said. The Dalai Lama has accepted the invitation, his spokesman Tenzin Taklha said.

"We are working on the details of his visit, which will take place soon," he said. Watch a report on the Dalai Lama's planned visit »

Typhoon Morakot slammed into Taiwan on August 8 and unleashed floods, mudslides and misery. More than 400 people were killed.

The visit of the Dalai Lama to Taiwan seemed certain to anger mainland China, which accuses both the Tibetan spiritual leader and the island nation of separatism.

Beijing accuses the Dalai Lama of advocating for Tibetan independence from China, and considers Taiwan to be a renegade province.

Taiwan and the mainland are only now smoothing their relationship after years of animosity.

Taiwan's relations with China have improved under Ma, who has taken a more conciliatory approach than his predecessor. Then-Taiwan President Chen Shui-bian rejected China's assertion that there is only "One China" and Taiwan is an inalienable part of it.

CNN's Ben Brumfield contributed to this report.

All About Taiwan • Natural Disasters • Dalai Lama