Libya's internationally recognized prime minister angrily promised to quit during a live television broadcast, though his government says he remains in office.

Prime Minister Abdullah al-Thinni's outburst early Wednesday on Libya TV, and the confusion surrounding it, shows the chaos still gripping Libya years after the ouster and killing of dictator Moammar Gadhafi.

Al-Thinni made the remark after a host grilled him with questions submitted by angry Libyans. The premier said: "If me leaving is the solution, I am announcing it on live TV that I am resigning."

Later Wednesday, a government official dismissed al-Thinni's remarks as unofficial. Al-Thinni would have to submit his resignation to parliament.

Al-Thinni's remarks come as the United Nations tries to negotiate a power-sharing deal between al-Thinni's government and the Tripoli-based Islamist-led government.