Security forces patrol on Tahrir Square in Baghdad, Iraq, Monday. Sunni militants captured a key northern Iraqi town along the highway to Syria early on
Security forces patrol on Tahrir Square in Baghdad, Iraq, Monday. Sunni militants captured a key northern Iraqi town along the highway to Syria early on Monday, compounding the woes of Iraq's Shiite-led government a week after it lost a vast swath of territory to the insurgents in the country's north. (AP Photo/Khalid Mohammed)

BAGHDAD - Sunni militants captured a strategic city along the highway to Syria on Monday, moving closer to their goal of linking areas under their control on both sides of the border.

The gains come as Iranian-backed Shiite militias and thousands of volunteers joined security forces to prepare for what the prime minister has vowed to be a fight to liberate every inch of Iraqi territory.

Tal Afar is dominated by ethnic Turkomen, who are both Sunni and Shiite, and is a key prize for the insurgents as it sits 150 kilometers (less than 100 miles) from the Syrian border. The al-Qaida breakaway group leading the push in Iraq also is fighting in the civil war next door in Syria where it controls territory abutting the Iraqi border.

With the Sunni militants' advance showing no signs of slowing, Secretary of State John Kerry said Monday that the Obama administration is willing to talk with Iran over deteriorating security conditions in Iraq and is not ruling out potential U.S.-Iranian military cooperation in stemming the advance of Sunni extremists.

Kerry also said in an interview with Yahoo! News that U.S. drone strikes "may well" be an option.

Tal Afar Mayor Abdulal Abdoul told The Associated Press that the city of 200,000 people was taken just before dawn, nearly a week after the al-Qaida splinter group known as the Islamic State of Iraq and the Levant began its lightning advance with the capture of Mosul, Iraq's second-largest city.

The capture of Tal Afar comes as fears of atrocities are high after Sunni militants posted graphic photos over the weekend that purported to show their fighters massacring scores of captured Iraqi soldiers.

The city is also close to the self-rule Kurdish region and many residents were fleeing to the relatively safe territory, joining an influx of refugees from Mosul and other areas that have been captured by the militants.

Fighting in Tal Afar began on Sunday, with Iraqi government officials saying that Sunni fighters were firing rockets seized from military arms depots in the Mosul area. They said the local garrison suffered heavy casualties and the main hospital was unable to cope with the wounded, without providing exact numbers.

A resident in Tal Afar, 420 kilometers (260 miles) northwest of Baghdad, said over the telephone that militants in pickup trucks mounted with machine guns and flying black jihadi banners were roaming the streets as gunfire rang out.

The local security force left the town before dawn, said Hadeer al-Abadi, who spoke to the AP as he prepared to head out of town with his family. Local tribesmen who continued to fight later surrendered to the militants, he said.

"Residents are gripped by fear and most of them have already left the town for areas held by Kurdish security forces," al-Abadi said.

The stunning turn of events in Iraq, 2 ½ years after the U.S. military withdrew from the country after nearly a decade at war, is threatening long-established borders and raising alarm in Washington, Turkey and other neighboring countries.

It also is deepening Iran's influence over fellow Shiite-dominated Iraq, giving the Islamic Republic a role similar to the one it plays in Syria. Tehran has thrown its weight behind President Bashar Assad's government in his struggle against the Iraqi-based extremist group and more moderate Sunni rebels.

Kerry said Monday that Washington is "open to discussions" with Tehran if the Iranians can help end the violence and restore confidence in the Iraqi government.

U.S. officials said earlier there is a possibility that a senior American diplomat may discuss Iraq with an Iranian delegation at nuclear talks in Vienna.

Security, meanwhile, has been tightened around the city, particularly on its northern and western edges, and food prices have dramatically gone up because of the transportation disruptions on the main road heading north from the capital.

Thousands of Shiites are already heeding a call from their most revered spiritual leader, the Iranian-born Grand Ayatollah Ali al-Sistani, to take up arms against the Sunni militants who have swept across the north in the worst instability in Iraq since the U.S. withdrawal in 2011.

The Sunni extremist group has vowed to take the battle to Baghdad and cities farther south housing revered Shiite shrines.

Shiite Prime Minister Nouri al-Maliki addressed some of volunteers on Sunday, vowed to retake every inch of territory seized by the militants.

"We will march and liberate every inch they defaced, from the country's northernmost point to the southernmost point," al-Maliki said. The volunteers responded with Shiite chants.