While the improved security situation in Iraq is changing views about the chances for success there, one common belief has remained unchanged: that the war is eroding U.S. military capabilities.

It is true that repeated deployments have caused considerable strain on service members, equipment and our ability to respond to other contingencies. These problems, however, only tell half the story. The Iraq war is also dramatically improving the military’s understanding, training and capabilities in irregular warfare. Since this is the preferred method of Islamic extremists, the experience in Iraq is transforming the military into the force required to help win the Long War.

The blunders of the early years are well-known. Trained for conventional warfare, the Army and Marine Corps were unprepared for the aftermath of the invasion of Iraq. Commanders emphasized killing or capturing insurgents, not securing the population as counterinsurgency doctrine emphasizes. U.S. units were stationed on large bases and didn’t develop the critical relationships with local leaders that only come from living among the people.

When units did interact with Iraqis, the interaction ranged from fruitless patrols in Humvees zipping through town to draconian operations that detained scores of innocent people. The Sunni insurgency only grew in this environment, attracting al Qaeda and spurring the growth of Shiite militias.

After a costly learning process, the military increasingly “gets it” when it comes to irregular warfare. The Army and Marine Corps published a new counterinsurgency manual that legitimized the radically different strategy that the Iraq War required. Pre-deployment training now includes realistic scenarios that test units’ ability to build relationships with local leaders and partner with host-nation forces.

Commanders, from the small-unit level to the general ranks, increasingly understand that population security, political reconciliation and economic development create legitimate government, which saps insurgents’ strength. As a result, conventional forces are now performing counterinsurgency missions at a level that many experts thought impossible.

My old unit returned from Iraq last spring after serving in a city in Anbar Province. As a mechanized reconnaissance company, its traditional mission focused on scouting for Soviet-style armored forces. The unit’s performance in Iraq more closely resembled that of the Green Berets.

Soon after occupying its forward outpost, the company met heavy insurgent attacks. But it did not over-react with mass detentions and other alienating tactics. Instead, the Marines took a patient approach to win the support of the population and eject the extremists hiding among them. They partnered with Iraqi police, established a pervasive security presence throughout the city, and worked with local leaders to improve basic services, governance and the economy. Such tactics used to be rare, but are now increasingly the norm, thanks to Gen. David Petraeus’s dogged emphasis on seeing counterinsurgency conducted by all units.

The Sunni tribal uprising that’s driven al Qaeda from Anbar Province and Baghdad wouldn’t have occurred without U.S. forces grasping the complexities of irregular warfare. Iraqi Sunnis rejected the oppressive version of Islam that al Qaeda imposed — but feared the consequences of resisting. By showing a willingness to help, U.S. troops presented a more trustworthy and less-threatening partner than al Qaeda, a remarkable achievement considering the vast religious and cultural differences between Americans and Iraqis.

U.S. commanders reached agreements with tribal leaders to accept their members into local security forces and establish combat outposts among the populace. Knowing that their families were safe from reprisals, the tribes gained the confidence to go after al Qaeda. Now U.S. officials are considering whether to adopt a similar model for Pakistan’s Northwest Frontier.

It remains to be seen whether the new counterinsurgency strategy will lead to a peaceful, democratic Iraq. Success ultimately depends on the ability of Sunnis and Shiites to overcome decades of mistrust and antagonism. But the current approach has created an opportunity for political reconciliation, as Sunnis have demonstrated that they reject al Qaeda’s campaign of terror against Shiites. The new strategy is also helping to prevent the establishment of an al-Qaeda safe haven in Iraq — and in this sense, it has already proven its worth.

The strains on the military are real. However, overemphasis on the “eroding” capabilities of the armed forces belies the incredible emergence of an irregular warfare capacity in the world’s greatest conventional military.

This hard-fought transformation faces resistance from advocates of the status quo in the military, and thus is easily reversible without political support. Such support is something Democrats and Republicans should be able to agree on.