He later said on Twitter that he would be speaking at the festival as a novelist, “which is my only identity,” and that he was not a politician. “But anyone who has ever read me knows that my books are deeply political, and China Dream is no exception,” he added. “All literature is political, whether the writer intends it to be or not.”

Phillipa Milne, the festival’s director, told reporters on Saturday that its goal was to promote Hong Kong’s literary arts while also “supporting the principles of free speech by providing a platform for a diverse spectrum of inspirational local and international writers.” She did not take questions.

The festival came amid growing concerns about Hong Kong’s future as a haven for rule of law and civil rights in Asia. Last week, for example, the political cartoonist Badiucao, whose works satirize leaders of mainland China and Hong Kong, called off a solo exhibition in Hong Kong after receiving threats from the Chinese authorities.

On Thursday, the Hong Kong authorities denied entry as a visitor to Victor Mallet, an editor at The Financial Times, a few weeks after he was expelled from the city. Mr. Mallet’s expulsion was widely seen as retaliation for his role in hosting a talk with a local independence advocate at the Foreign Correspondents’ Club of Hong Kong in August.

On Saturday, Mr. Ma declined to directly answer a question about whether he felt safe in Hong Kong, but he noted that he had informed the British authorities of his travel plans. “I know if I ever disappear, they will look for me,” he added.

Emily Lau, a former Democratic Party member of Hong Kong’s Legislative Council, said the back-and-forth over Mr. Ma’s appearances created an emotional “roller coaster” for many people in the city.

Ms. Lau said she believed the Hong Kong Jockey Club, which finances and operates the Tai Kwun center, had faced political pressure to cancel Mr. Ma’s visit, and that the reversal of the cancellation was not much of a victory because it had already set a damaging precedent.