The Iraqi Army won't be able to defend the country for another 5-10 years. That's because most army troops are trained and equipped for internal security and counter-terrorist operations. There is only one armored division, and it is equipped with Cold War era T-72s. In two years, Iraq expects to have a second armored division, equipped with American M-1 tanks.
There are currently no mechanized divisions (those equipped with infantry fighting vehicles like the U.S. M-2 Bradley), only motorized ones (using trucks to move everyone and everything.) Iraq cancelled an order for American Stryker wheeled armored infantry vehicles six months ago, and ordered more used M-113 tracked infantry transports. The army needs self-propelled artillery and, most important of all, a larger and more robust logistical (supply and maintenance) system.
Still, the Iraqi army has come a long way since 2003, when the old, Sunni Arab dominated force was disbanded, and a new one, loyal to a democratic government, and led by newly recruited and trained officers, was built from scratch. Because the Sunni Arabs loyal to Saddam (and Sunni Arab rule) fought a four year terror campaign, while the army was forming, the best troops were formed into special "intervention" units. This resulted in an army organization consisting of one "Intervention Corps" and three other corps of lesser quality. Total manpower is about 250,000 troops. Most divisions have four brigades, with a total strength of about 12,000 troops.
The most likely threats are Iran and Syria. Both have large forces equipped with Cold War era Russian equipment. The Iraqi plan is to stock up on superior American weapons, and train Iraqis to use that stuff with effectiveness approaching that of the Americans. That takes money, and time. Iraq is buying second-hand F-16s, but it will take three or four years to get the pilots and ground crews up to an acceptable level of performance. Along with this, the Iraqis want to buy modern anti-aircraft missile systems, and get them into service.
So, although the remaining U.S. combat forces are, technically, leaving Iraq later this year, it will be another 5-10 years before Iraq can defend itself. Until then, it will have to make nice with its Arab neighbors (even Syria, which is on the Iranian payroll), and the United States.