BAGHDAD, Iraq (CNN) -- Prime Minister Nuri al-Maliki has ordered his government to take down concrete blast walls that line Baghdad's streets and surround whole neighborhoods, the Iraqi military announced Thursday.

The walls split Baghdad along sectarian lines, shielding some from Shiite militias and Sunni insurgents.

"The concrete walls will be taken off from the main roads and side streets in all Baghdad areas, with no exceptions and within 40 days," a statement from Iraqi military's Baghdad Operations Command read.

The massive concrete barriers, typically 3 meters (10 feet) tall, were quickly erected around many Baghdad buildings after the U.S. invasion in 2003.

They mushroomed during the sectarian warfare that followed the 2006 bombing of a Shiite Muslim shrine in Samarra, when they were put up to separate Shiite and Sunni districts across Baghdad.

While they split the city along sectarian lines, they also managed to protect neighborhood residents from Shiite militias and Sunni insurgents and helped U.S. troops and Iraqi government forces manage security within them.

The order does not cover the Green Zone, which houses Iraqi government buildings and the U.S. Embassy, or military installations, government institutions, hotels or some private companies.

The order came after meeting Wednesday with high-ranking security officials, according to the command.

Iraqi forces are now calling the shots on issues related to security in their homeland since June 30, the date U.S. combat troops were mandated to leave Iraqi cities and towns pursuant to a joint security agreement.

All About Baghdad • Iraq War • Nuri al-Maliki