President Recep Tayyip Erdogan has said two Turkish troops have been killed in Libya where they back the UN-recognised government in the North African state's conflict.

Turkey provides military support to the Government of National Accord (GNA), which is based in the capital, Tripoli. Since April, the city has been under an assault by forces loyal to renegade military commander Khalifa Haftar, who is aligned with a rival administration based in the country's east.

More:

Last year Ankara and Tripoli signed a military cooperation deal and Turkey has since sent troops and allied Syrian fighters there.

"We have two martyrs there in Libya," Erdogan told reporters on Tuesday before leaving for Azerbaijan on an official visit. The president had previously said that Turkey had "several martyrs" in Libya.

Erdogan also stressed that fighters from the Syrian National Army - a Turkey-backed rebel group fighting against pro-Damascus forces in northern Syria - were working with Turkish personnel in Libya.

"Those going from Syria, from the Syrian National Army there have a common goal. They are there within the framework of these common goals ... Our brothers who are with us in Syria see being there with us as an honour," Erdogan added.

On Sunday, Haftar's Libyan National Army (LNA) said they had killed 16 Turkish soldiers in recent weeks. Since the deployment of Turkish soldiers and sophisticated equipment to the GNA, the LNA has lost some of its gains. The LNA is backed by the United Arab Emirates and Egypt.

At a summit in Berlin last month, world powers agreed that hostilities must stop in Libya while a political process takes place. Ankara has since accused Haftar of violating the ceasefire, saying its guarantees regarding a UN arms embargo to Libya were dependent on a durable truce.

Ceasefire talks between Libya's warring sides, which resumed last week after a pause over clashes on the ground, were in the "right direction", the UN envoy for Libya said on Friday. But, legislators based in areas under Haftar's control said on Monday they would not participate in talks with politicians allied to the GNA.