Libya’s U.N.-backed Government of National (GNA) has formally requested Turkish “air, ground and sea” military support to fend off an offensive by Gen. Khalifa Haftar’s forces to take the capital Tripoli, a GNA official said Thursday.

The country’s interior minister said Thursday that Tripoli will ask Turkey for military support if the fight over the capital escalates. Haftar’s forces, which are based in eastern Libya, could not be reached for comment.

“We cannot stay idly when the UN-recognized Libyan government demands our help,” Ankara Deputy Emrullah İşler said in a tweet late in the same day.

“As Turkey, we will accept the invitation of legitimate Libyan government, with whom we have a history of relations spanning 361 years,” he added.

In response to the country’s invitation, Turkey’s President Recep Tayyip Erdoğan said earlier his country will introduce a bill to send troops to Libya as soon as Parliament resumes.

The military mandate to send troops to Libya will be on Parliament’s agenda when it resumes early January. He reiterated Turkey’s determination to provide the necessary assistance to the Tripoli administration, which he said is fighting against “putschist commander Haftar, supported by various European, Arab countries.”

Last month Turkey’s Parliament approved a security and military deal with Libya’s GNA. The deal went into effect yesterday after it was published in the Official Gazette.

The deal allows Turkey to provide military training and equipment at the request of the Libyan government, which controls the capital, Tripoli, and some of the country’s west.

Following the military cooperation deal, Erdoğan said Ankara might consider sending troops to Libya if the Tripoli government made such a request.

Turkey supports the U.N.-backed government against the militia and mercenaries of self-proclaimed military leader Haftar. Tripoli-based GNA Prime Minister Fayez al-Sarraj sent letters to the leaders of the U.S., Britain, Italy, Algeria and Turkey, urging them to “activate security cooperation deals.”

The aim is to help the GNA “face aggression against the Libyan capital … by any armed group operating outside the legitimacy of the state, to preserve social peace and achieve stability in Libya,” he said.

Al-Sarraj also called for help to battle Daesh and al-Qaida, saying Haftar’s offensive had given the terrorist groups “the appropriate opportunity and environment” for a resurgence in Libya.

Following the GNA’s announcement over Turkey, the U.N. mission in Libya, UNSMIL, renewed its call for a political solution to the conflict.

Since the ousting and death of the longtime dictator, Muammar Gadhafi in 2011, two seats of power have emerged in Libya. Turkey, Qatar and Italy have been allied with Sarraj’s government based in Tripoli, while Haftar, who commands forces based in eastern Libya, is backed by France, Russia and key Arab countries, including Egypt, the United Arab Emirates (UAE) and Saudi Arabia.