(Reuters) - Two Bangladeshi citizens, among a group of foreign workers taken hostage by the Islamic State militant group in an attack on a Libyan oilfield, have been released after more than two weeks, the foreign ministry said on Wednesday.

Foreigners have increasingly become targets in Libya's turmoil, where two rival governments are battling for control and Islamist extremists have grown in the chaos that followed Muammar Gaddafi's ouster four years ago.

Up to 10 foreign workers were missing after the attack on the Al-Ghani oilfield south of the city of Sirte, Czech and Libyan officials have said.

Helal Uddin and Mohammed Anowar Hossain were released on Tuesday evening and now staying overnight at Sirte hospital, about 700 kms (435 miles) from Tripoli, the foreign ministry said in a statement.

Western governments are backing U.N. negotiations to end the crisis in Libya, worried that the large North African state just across the Mediterranean from mainland Europe is becoming a haven for Islamist militants.

Libyan militants claiming loyalty to Islamic State in Iraq and Syria have been blamed for high-profile attacks this year involving foreigners, including an assault on a Tripoli hotel and the beheading of a group of Egyptian Christians.

Militants this month also stormed and damaged several Libyan oilfields around al-Ghani, forcing the government to declare force majeure, pull out workers and shut down production on 11 oilfields in the central Sirte basin.

U.N.-backed talks to form a unity government and a lasting ceasefire in Libya are continuing in Morocco. But both sides face internal splits over the negotiations and fighting between the two governments continues.