ANKARA (Reuters) - Turkish President Tayyip Erdogan paid a surprise visit to Tunisia on Wednesday to discuss cooperation for a possible ceasefire in neighboring Libya, where Ankara supports the internationally recognized government.

Erdogan, speaking at a joint news conference with Tunisia’s President Kais Saied, also reaffirmed Ankara’s willingness to send troops to Libya if it received such a request.

Erdogan’s visit to Tunis came a month after Turkey and Libya signed two separate accords, one on maritime boundaries in the eastern Mediterranean and another on security and military cooperation.

Turkey backs Fayez al-Serraj’s Government of National Accord (GNA), which has been fending off a months-long offensive by Khalifa Haftar’s forces in eastern Libya.

Erdogan, the first head of state to visit Tunis since Saied’s landslide election win in October, said the developments in Libya were having a negative impact on neighboring states, including Tunisia.

“We discussed the possible steps we can take and cooperation opportunities with the aim of establishing ceasefire in Libya as soon as possible and returning to a political process,” Erdogan said.

In Tunisia’s hybrid political system, the prime minister controls most policy areas, while the president is in charge of foreign affairs, defense and security. Tunisia’s main foreign policy interests have traditionally been in maintaining strong ties with its two much larger neighbors Algeria and Libya.

POSSIBLE TROOP DEPLOYMENT

Last week, Erdogan said Turkey would not remain silent in the face of “mercenaries” such as the Russian-backed Wagner, a group of private military contractors, supporting Haftar’s forces in Libya. Moscow has said it is very concerned about the prospect of Turkish troops being deployed there.

Slideshow ( 8 images )

On Wednesday, Erdogan reiterated that Turkey would evaluate the option of deploying troops if the GNA asked for support after signing the military agreement, and added that the Wagner group had “no connections, nothing” in Libya.

“Until today, we have never been unwanted guests anywhere, but if a call is made then we will surely evaluate it and take steps,” Erdogan said. “Serraj is the GNA’s premier. We are taking steps with him. Haftar has no such title.”

Slideshow ( 8 images )

On Tuesday Erdogan’s spokesman Ibrahim Kalin said Turkey’s parliament was working on a draft bill that would allow troop deployment to Libya.

Turkey has already sent military supplies to the GNA despite a United Nations arms embargo, according to a U.N. report seen by Reuters last month. Haftar, meanwhile, has received support from Russia, Egypt and the United Arab Emirates.

Turkey and Russia have been cooperating in the search for a political solution to Syria’s eight-year war, even though they back opposing sides. They also have strong ties in defense and trade.

Erdogan’s visit to Tunis comes as Turkey ramps up efforts to strike deals with nations around the Mediterranean, where Ankara has been at loggerheads with Greece over resources off the coast of the divided island of Cyprus.

Athens was outraged by the agreement signed by Turkey and the GNA last month mapping out maritime boundaries in the eastern Mediterranean.

Greece says the deal violates international law, but Turkey says it aims to protect its rights in the region and that the accord is in full compliance with maritime laws.