MOSUL, Iraq — For much of the past decade, Iraq’s third-largest city looked and felt like a tense prison yard, with twisted razor wire hung across many streets, and residents avoiding eye contact out of mistrust between Arabs and Kurds.

The razor wire blocked off neighborhoods as Iraqi security personnel and U.S. soldiers battled against a Sunni Muslim insurgency so effective that the local police chief concedes it was the insurgents — not the police or army — who were regarded by young boys as heroic.

With those battles mostly subsided, the razor wire is now being pulled back, inch by inch, leaving most streets now only partially barricaded. But like the razor wire itself, Mosul remains a city that can be pulled in either direction, adding to apprehensions on all sides as U.S. forces prepare to withdraw this month from checkpoints they still man with Iraqi soldiers, including the Kurdish peshmerga.

“You cannot in one or two years clean all of Mosul from the terrorists,” said Maj. Gen. Ahmed Hassan Ali al-Juboori, the commander of the area’s federal police force, who has been shot, kidnapped and had his house blown up in separate incidents since 2004. “It’s day by day, but things are getting better.”

Home to some of Iraq’s most established Sunni, Kurd and Christian communities, Mosul sits on the banks of the Tigris River in Ninawa province amid some of the world’s oldest archeological and religious treasures. But following the collapse of Iraqi President Saddam Hussein’s regime, thecombustibility of the province underscored the U.S. military’s inability to tame the insurgency and ethnic and religious divisions that nearly broke up the country.

Clashes erupted between armed Kurdish and Sunni militias. Christians, who were largely protected by Hussein, found themselves brutalized at the hands of Muslim extremists. And insurgents and terrorists were so bold that they used to control nearly every police station and held neighborhood parades, Mosul officials said.

Though that violence has greatly diminished, the pending departure of the 15,000 or so U.S. troops still stationed in the region has officials warning that Ninawa province could once again become a flash point as Iraqi government leaders struggle to prove the country can police itself.

As for now, the Iraqi Army’s 2nd Division largely controls the predominately Sunni eastern side of Mosul with a force that includes soldiers on many street corners. Federal and local police protect the ethnically diverse western side of the city. The joint outposts manned by U.S. and Iraqi soldiers are intended to ease Arab-Kurd tension in disputed areas on the outskirts of the city.

‘The status quo is working’

Like Baghdad, another Iraqi city facing an uncertain future, Mosul and surrounding areas will prove a key test for how long Prime Minister Nouri al-Maliki can keep military control of an urban area, if local officials can withstand growing unease about a lack of services, and whether the country’s Sunni minority decides to turn to guns or mediation to address concerns of growing isolation.

“If there no stability in Ninawa, there won’t be stability in Iraq,” said Deldar Zebari, who is Kurdish and serves as the deputy head of the local provincial council.

For the time being, however, U.S. military commanders cite Mosul as an example of their successful efforts to partner with Iraqi security officials to bolster training while stepping up efforts to kill or arrest terrorists.

“The status quo is working right now,” said Lt. Col. Gerald A. Boston, a commander with the U.S. Army’s 1st Calvary Division, which helps train Iraqi Army units near Mosul. “As long as people feel safe, it gives politicians time and space to work things out.”

Though many buildings in Mosul are scarred by bullet holes and bomb damage, shoppers have returned to downtown, where stores are once again open past dusk and police and Iraqi soldiers once again feel brave.

“Before, when we wanted to go back and forth from base to home, we had to use to use dirt roads,” said Faris Aied, 21, a soldier in the Iraqi Army. “Now, we can take main roads and use our civilian cars to go home.”

Yet Mosul remains one the most dangerous places in Iraq, highlighting how hard it remains to assess what normalcy will look like in a country scarred by more than eight years of war.

Daily reports of violence in Mosul reveal a continued grisly stream of bombings, abductions and assassinations, some of which are carried out in elaborate ruses where terrorists set up fake police checkpoints to intercept unsuspecting victims.

In March, Ninawa’s governor, Atheel al-Nujaifi, and his brother, Usama al-Nujaifi, the speaker of Iraq’s parliament, had to be rescued by police after the building was nearly overrun by demonstrators upset about a lack of services. Athleel al-Nujaifi later suggested that the army, under the control of Maliki, had not done enough to protect the provincial council building.

Tensions swelled further last month after Usama al-Nujaifi, the parliamentary speaker, suggested the creation of a semiautonomous Sunni region of Iraq, similar to Kurdistan. A nationwide outcry erupted, and local Sunni officials in Mosul quickly disassociated themselves with the idea. But Sunni leaders worry that Kurdish peshmerga forces will try to exert more control once U.S. forces depart.

“We could have big troubles,” said Abdul Rahim al-Shimmari, a Sunni who heads the local council’s security committee.

Amid continued security challenges and a gritty landscape that includes dairy cows and goats feasting on piles of garbage next to city streets, U.S. diplomats are still grappling over what, if any, role they will play in Mosul following the departure of U.S. forces.

Under plans to continue U.S. efforts to stabilize Iraq, State Department plans call for more than 17,000 of diplomats and contractors to take the place of American military personnel. Initially, the United States planned to open a consulate in Mosul, as it did last week in Basra in southern Iraq.

But U.S. Ambassador James F. Jeffrey said those plans are now on hold amid budget and security concerns.

“There are a variety of questions, including the sustainability of it,” Jeffrey said. “We are just going to have to wait and see on Mosul.”