| BASHIQA, Iraq
BASHIQA, Iraq Kurdish peshmerga forces who stormed an Islamic State-held town in northern Iraq were confident they would take control quickly.
Then a jihadist sniper started shooting from a red building.
Every five minutes or so, he opened fire at the Kurdish forces and the American special forces accompanying them, holding up any advance by their convoy of 40 vehicles.
What unfolded for hours spoke volumes about the difficulties that Iraqi forces will face in the battle for the major city of Mosul, about 15 km (10 miles) to the southwest.
Senior Kurdish intelligence officials say that Islamic State, which sent waves of suicide car bombers to slow the army's advance on the city outskirts, will prove just as formidable in the tight urban alleyways where it has deployed a large number of snipers.
On the streets of Bashiqa on Monday the Kurdish fighters and their American support could call on an impressive collection of firepower. American MRAP (Mine-Resistant Ambush Protected) vehicles with computer-operated 50 caliber machine guns were lined up on the street near the sniper.
American special forces clutching sophisticated sniper rifles, with advanced technology at their disposal, carefully studied the situation as the bullets whizzed by and ricocheted off buildings.
Across the street from them was a peshmerga fighter, holding a machine gun, with 1,000 bullets strapped around his waist.
"I have told my men to advance to get those dogs," peshmerga officer Rasheed Haji Rosta said. But no solution was in sight, despite the bravado.
Every 10 minutes or so the sniper fired several rounds of bullets in their direction. At one stage, an Islamic State fighter could be seen in the distance, running between houses carrying an AK-47 assault rifle.
The Americans hit back by firing bullets from their MRAP machine gun. The bullets could be seen hitting the balcony of the red building. The sniper hit back in return, each bullet bearing a message: 'You haven't got me'.
A red flash appeared from the muzzle of the sniper's rifle every time he opened fire. At one point three U.S. special forces jumped out of the way as the bullets flew near them.
Kurdish guerrillas had been planning the assault on Bashiqa for weeks. In that time, Islamic State militants carried out nighttime suicide bomb attacks against their makeshift base nearby.
Early on Monday, after days of clearing bombs from nearby areas, Kurdish peshmerga forces entered Bashiqa. One hour after they moved into the town, which stands on a plain at the foot of a mountain, two car bombs exploded near their convoy, sending up plumes of white smoke just 50 feet (15 meters) away.
No one was wounded by the bombs, but any sense of relief was soon eroded by the growing tension caused by the sniper.
Aside from the barrage of bullets from the MRAP vehicles, wire-guided missiles were also fired at the sniper's building. Adjacent buildings were also targeted after gunfire was seen coming from them.
It was not clear whether the sniper had comrades with him nearby or was moving from one building to the other in underground tunnels that Kurdish officials say are used by the militants when they come under serious pressure.
Islamic State militants swept through northern Iraq in 2014, seizing Mosul and swallowing up towns and villages like Bashiqa, where their radical ideology was imposed through brute force.
Iraqi forces put up virtually no resistance at the time but have recently, along with the Kurds, recaptured dozens of villages from Islamic State.
A victory in Mosul would weaken the jihadists and give Iraqi forces much needed credibility. In order to do that, they will have to patiently eliminate a far greater number of Islamic State snipers than the ones that were deployed in Bashiqa.
Kurdish and Iraqi officials say the militants have brought in highly skilled snipers from conflict zones like Chechnya.
At one point it seemed as if the sniper had been silenced.
Then gunshots came from another direction, prompting one of the American special forces snipers to yell: "It's coming from the green building." Nearby one of his comrades said: "Tell Steve we need the missiles."
While the Americans showed a sense of urgency, crouching near buildings to try to find a direct line of fire to the sniper, two Kurdish fighters calmly sat on the street that had come under fire and ate rice and beans from a styrofoam plate.
Another Kurdish fighter nearby focused on his black tea kettle, oblivious to the explosions of artillery that were fired towards the sniper.
In the end, the peshmerga and American special forces seemed to lose patience with the cat and mouse game and the row of houses where the sniper was located was hit by three air strikes.
(Editing by Dominic Evans and Anna Willard)