Hong Kong authorities on Wednesday withdrew an unpopular extradition bill that sparked months of chaotic protests that have since morphed into a campaign for greater democratic change.

"I now formally announce the withdrawal of the bill," Secretary for Security John Lee told the city's legislature. Pro-democracy lawmakers immediately tried to question him but he refused to respond and the assembly's president said the rules did not allow for debate.

The long-expected scrapping of the bill was overshadowed by the drama surrounding the release from a Hong Kong prison of the murder suspect at the heart of the extradition case controversy.

Chan Tong-kai, who completed a separate sentence for money laundering, told reporters after his release that he wished to turn himself in to authorities in Taiwan, where he's wanted for killing his pregnant girlfriend, Poon Hiu-wing.

Taiwan announced Tuesday it was willing to send a delegation to bring Chan back to the self-ruled island for trial, but Hong Kong rejected the offer, saying the suspect should be allowed to fly unaccompanied to Taiwan to turn himself in.

The controversy is rooted in the unwillingness of Hong Kong, a semi-autonomous Chinese region, to recognize the legitimacy of the legal bodies in Taiwan, which the communist authorities in Beijing consider a breakaway province.

China has refused all contact with the administration of Taiwan's directly elected President Tsai Ing-wen over her refusal to endorse Beijing's contention that the island is Chinese territory awaiting annexation. That appears to have compelled Hong Kong to reject cooperation with Taiwan over Taipei's insistence on a "mutual legal assistance" deal with Hong Kong that would require their institutions to deal with each other on an equal basis.

Tsai herself weighed in Wednesday on the Chan case, emphasizing that, although both the alleged perpetrator and the victim are from Hong Kong, Taiwan was willing to put Chan on trial if Hong Kong does not.

However, she said there was no possibility of Chan simply catching a flight to Taipei and insisted Taiwan would not sacrifice its sovereignty in handling the matter.

"I would like to explain that in this case, the murderer is a wanted subject in Taiwan. He is already a wanted criminal suspect in Taiwan with a warrant out for his arrest," Tsai said during a visit to the Taiwanese-held island of Kinmen just off the Chinese coast.

"Therefore, regarding this case, there is no issue of free travel or just being a backpacker. There is only the matter of arrest and no question of simply turning oneself in," Tsai said.

Taiwan's Mainland Affairs Council said allowing a murder suspect to fly on his own would ignore the safety of other passengers and that Hong Kong's approach would indulge Chan and make Hong Kong "a criminal paradise where murderers can walk around."

Chan, 20, returned to Hong Kong alone last year after traveling to Taipei with Poon on vacation. Her body was found later packed in a suitcase and dumped in a field, while Chan made off with her bank card, mobile phone and other valuables.

"I am willing, for my impulsive actions and things I did wrong, to surrender myself, to return to Taiwan to face sentencing and stand trial," Chan told reporters outside prison before being whisked away in a van to an exclusive gated community beyond the reach of the media.

Hong Kong leader Carrie Lam had repeatedly cited Chan's case as justifying the proposed amendments to the extradition legislation, saying he could not be sent to the self-ruled island because there was no extradition agreement in place.

But the proposal stoked widespread fears residents of Hong Kong, which has maintained its own independent courts since reverting from British to Chinese rule in 1997, would be put at risk of being sent into mainland China's Communist Party-controlled judicial system. Lam was forced to announce last month that she would drop the bill in the face of fierce opposition.

The protests erupted in early June and snowballed into the city's biggest political crisis in decades, expanding to demands for universal suffrage and an investigation into allegations of police abuses, most recently including the spraying of a mosque and bystanders with high-pressure blue-dyed water from an urban assault vehicle.

Amid the ongoing political chaos and street violence, Lam's future as Beijing's pick to lead Hong Kong has been repeatedly questioned.

The newspaper Financial Times reported Beijing may be planning to replace Lam with an interim chief executive as early as March, but is holding off so as not to appear to be caving into the opposition's demands.

Associated Press video journalist Taijing Wu contributed to this report.