BAGHDAD - British Prime Minister Theresa May paid a surprise visit on Wednesday to Baghdad where she met her Iraqi counterpart Haider al-Abadi and praised the country's efforts to battle the Islamic State group. May's visit came after Iraqi forces backed by an international coalition including Britain ousted the Islamic State group from swathes of Iraq it had controlled since 2014. May praised "the bravery and sacrifice of the Iraqi security forces" and pledged British support "for as long as the Iraqis want and need it". 

Britain , which took part in the US-led Iraq invasion of 2003 which toppled the regime of dictator Saddam Hussein, has played a key role in the coalition battling IS. 

Experts have long argued that its participation in the 2003 invasion made Britain a target for jihadist groups. 

May told a press conference in Baghdad that Britain would "work with partners across the region to develop the capabilities that will enable us to deal with the threat posed by foreign fighters." 

She said she had visited British troops training Iraqi security forces at the Taji military base, north of Baghdad

The British premier also reiterated Britain 's support for a unified Iraq, two months after Iraqi Kurds overwhelmingly voted for independence in a referendum bitterly contested by Baghdad and ruled unconstitutional by Iraq's top court. 

She called for a "stronger, more inclusive, unified Iraqi state" and encouraged the Iraqi government "to respond positively" to calls by the Kurdish leadership for dialogue. 

"We (also) encourage the Kurdish regional government to respect the Iraqi federal supreme court ruling on the unconstitutionality" of the vote, she said. 

May also pledged funds to continue training Iraqi forces and to support "efforts to return (displaced people) and restore stability". 

Abadi added that the leaders had discussed "encouraging British businessmen and businesses to invest... in Iraq, to take part in building Iraq and bringing stability" to the country. 

May left London late Tuesday for a three-day visit to the Middle East, where she is also set to meet Saudi and Jordanian leaders in a bid to bolster regional ties. 

She will hold talks on issues including Qatar and Yemen with Saudi Arabia's Crown Prince Mohammed bin Salman, before heading to Jordan for meetings with King Abdullah II and Prime Minister Hani Mulki. 

Saudi Arabia is Britain 's largest trading partner in the Middle East, and London has signed off on more than £3.3 billion ($4.4 billion/3.7 billion euros) worth of arms sales to Riyadh since March 2015. 

During that time Saudi Arabia has embarked on a bombing campaign in Yemen that has been condemned for contributing to a humanitarian disaster.