President Obama and Iraqi Prime Minister Nouri al-Maliki outlined a broad agenda for postwar cooperation Monday as they marked the impending end of America’s long conflict in the Middle East.

Speaking at a midday news conference, Obama and Maliki pledged to work together to ensure Iraq’s political stability and strengthen its national defense, as Iran’s creeping influence in the region continues to worry U.S. policymakers.

Obama said the postwar partnership will comprise programs to strengthen Iraq’s still-brittle democratic institutions, expand trade and commerce between the two countries, increase education exchanges and enhance Iraq’s security.

That will include U.S.-funded military training programs similar to ones the United States carries out in other countries. On Monday, the Obama administration announced plans to sell an additional 18 F-16 jets to Iraq to patrol its vulnerable airspace, raising the total to be sold to 36 for about $5.3 billion.

Both leaders also cited the thousands of Iraqis and Americans killed in a conflict that deposed Saddam Hussein but also set in motion a sectarian conflict suppressed for decades by his brutal rule.

“They are the reason that we can stand here today,” Obama said. “And we owe it to every single one of them — we have a moral obligation to all of them — to build a future worthy of their sacrifice.”

The president announced in October that he would bring all U.S. troops home from Iraq, still fragile and fractured along ethnic and sectarian lines, by the end of the year, declaring that “after nearly nine years, America’s war in Iraq will be over.”

The decision provoked sharp criticism from most Republican presidential candidates, who have suggested that the move was motivated more by domestic politics than by military advice. A Washington Post-ABC News poll last month found that 78 percent of Americans support Obama’s decision to leave Iraq at the end of the year.

The withdrawal timeline was set by Obama’s predecessor, George W. Bush. But negotiations between Iraqi and U.S. officials to extend the presence of several thousand American troops, for training and counterterrorism operations, collapsed when Iraq’s parliament refused to grant U.S. military personnel immunity from prosecution in Iraqi courts past the deadline.

In a statement, Sen. John McCain (R-Ariz.) said Monday that “the meeting between President Obama and Prime Minister Maliki today cannot obscure the fact that both men have failed in their responsibilities with regard to our shared security interests.”

Maliki’s visit marks the start of a week in which Obama and other U.S. officials plan to commemorate the war, which Obama opposed as a candidate, with events scheduled in the United States and in Iraq.

On Wednesday, the president and first lady Michelle Obama travel to Fort Bragg in North Carolina to speak to the troops about the war. After his Monday meeting with Obama, Maliki headed to Arlington National Cemetery, where he laid a wreath in honor of Americans killed in the war.

Since taking office, Obama has withdrawn nearly 150,000 U.S. troops from Iraq, and, for the first time in more than a decade, no American service member is preparing to deploy there. About 4,500 U.S. troops have died in Iraq, and the war has cost the Treasury nearly $1 trillion.

Asked whether he stood by his past characterization of the 2003 U.S.-led invasion as “dumb,” Obama said, “History will judge the original decision to go into Iraq.”

“But what’s absolutely clear is, as a consequence of the enormous sacrifices that have been made by American soldiers and civilians — American troops and civilians — as well as the courage of the Iraqi people, that what we have now achieved is an Iraq that is self-governing, that is inclusive and that has enormous potential,” he said. “There are still going to be challenges.”

Obama said that as Iraq’s battered oil industry recovers from war, the country’s economy will grow rapidly. He noted that some forecasts predict that Iraq’s economic growth will surpass that projected for India and China in the coming years.

But Obama also expressed concern about Iran’s expanding influence in the region and tacitly warned the Islamic republic not to meddle in Iraq as the last U.S. troops prepare to leave by Christmas.

“Just as Iraq has pledged not to interfere in other nations, other nations must not interfere in Iraq,” Obama said. “Iraq’s sovereignty must be respected.”

In his remarks, Maliki said he wants to “complete the equipping of Iraqi forces.” That includes the purchase of the F-16 aircraft and the training of Iraqi pilots. Much of Iraq’s air force and its antiaircraft defenses were destroyed in the invasion.

Obama and Maliki have expressed different views on the political changes sweeping the region, as revolt challenges longtime dictatorships in Syria, Yemen and other nations.

Obama acknowledged what he called “tactical disagreements” with Maliki over whether Syrian President Bashar al-Assad should step down, as he continues a crackdown on dissidents seeking to topple his government. Obama has called for Assad to resign; Maliki has refrained from doing so.

But Obama said he was confident that Maliki, who is Shiite, was setting policy based on his judgment of what is best for Iraq, not based on Iranian interests in the region. Assad has been a longtime ally of Shiite-ruled Iran.

“I believe that the parties, all the parties, realize the dangers of a sectarian war in Iraq, in Syria and in the region,” Maliki said. “Because it will be like a snowball that it will expand and it will be difficult to control it.”

Polling analyst Scott Clement contributed to this report.