KIRKUK, Iraq (AP) -- Clashes with Islamic State militants killed a senior Kurdish military commander and eight of his fighters just outside the disputed northern Iraqi city of Kirkuk on Friday, officials said.
Attacks elsewhere killed 27 people, with twin bombs hitting a crowded market in Baghdad and a suicide bomber targeting pro-government Shiite militiamen who were manning a checkpoint outside a city north of the Iraqi capital.
The casualties near the oil-rich Kirkuk were a heavy setback for the Iraqi Kurds, who have been at the forefront of the battle against the Islamic State group, which has captured a third of both Iraq and Syria in its blitz last year.
Also Friday, a car bomb exploded outside an empty, closed hotel near Kirkuk's police headquarters, wounding two people. Both the Kurdish troops and the city's security force have been trying to rout the IS group from Kirkuk, about 290 kilometers (180 miles) north of Baghdad.
After the car bombing, three gunmen took positions inside the hotel, located in the city center, triggering a firefight with the Kurds and the police.
Associated Press footage from the scene showed members of the Kurdish troops and the local police firing at the Qassir Hotel in Kirkuk and then storming it. Officials later said the gunmen were all killed.
The Kurdish Brig. Gen. Shirko Fatih and eight Kurdish fighters died in clashes south of the city earlier in the day, after the IS militants attacked the peshmerga fighters' positions, said Brig. Khatab Omar.
The U.N. assistance mission in Iraq said Friday it was evacuating its foreign staff from Kirkuk to Irbil, the capital of the Kurdish autonomous region in northern Iraq, due to "a rapid deterioration in security in Kirkuk city."
A UNAMI statement said the mission was also forced to halt its activities and bar employees from moving around freely within the Kurdish region, except for the cities if Irbil, Suleimaniya and Dahuk.
Kirkuk is home to a mix of Arabs, Kurds and Turkmen, who all have competing claims to the oil-rich area. The Kurds want to incorporate it into their self-ruled region in Iraq's north, a proposition strongly opposed by Arabs and Turkmen.
After the IS group's blitz last summer and the quick collapse of the Iraqi army, Kurdish forces took control of the city. Since then, Kirkuk has often come under Islamic State attacks, with the militants likely hoping to seize the oil fields near the city.
Iraq has been facing its worst crisis since the 2011 withdrawal of U.S. troops, with Islamic State militants now in control of about a third of the country.
In the Baghdad market attack, a bomb first exploded near carts selling used clothes in the central Bab al-Sharqi area, followed by a second bomb as people rushed to help victims from the first blast. Police and hospital officials said 19 people were killed and 28 were wounded. The officials spoke on condition of anonymity because they were not authorized to speak to the media.
Also in Baghdad, mortar shells landed on a residential area in the Shula neighborhood, killing four people and wounding seven others, said police and hospital officials.
Police officials also that said a suicide bomber drove his-explosive-laden car into a security checkpoint manned by Shiite militiamen near the city of Samarra, 95 kilometers (60 miles) north of Baghdad, killing four militiamen and wounding 10.