Mr Brown told the BBC: "I feel that the task that we set out to do is being done and that's why we can take a decision to bring most of our forces home."
At a joint press conference, Mr Maliki confirmed that the agreement included a provision for the Iraqi government to request an extension of the British military presence.
However, both leaders indicated it was not expected to be used.
Mr Brown said people had been given an "economic stake in the future of Iraq" and said: "I am proud of the contribution British forces have made. They are the pride of Britain and the best in the world."
In their joint statement, the leaders said the role played by the UK combat forces was "drawing to a close" but the partnership between Britain and Iraq would "continue to take on new dimensions" and be strengthened.
The withdrawal of UK troops is expected to start in the spring although Mr Brown suggested the biggest withdrawals would take place in the summer.
Chief of the Defence Staff Air Chief Marshal Sir Jock Stirrup played down suggestions troops would be transferred to Afghanistan.
He said: "We cannot just have a one-to-one transfer from Iraq to Afghanistan. "The net result must be a reduction in our operational tempo because the forces have been overstretched for too long."
But he added they would have to look at the "requirement on the ground".
In Basra Mr Brown visited British troops and laid a wreath in memory of the 178 British servicemen and women who have been killed in Iraq since the 2003 invasion.
Gordon Brown paid tribute to servicemen and women who have died
Responding to the announcement, shadow defence secretary Liam Fox said it showed "renewed confidence" in the Iraqi government's ability to maintain security.
But he questioned the timing of the announcement saying the government's policy had previously been to say troops would leave "when circumstances allowed on the ground".
"I don't know why the government would have changed their mind and given such a specific commitment to dates.
"I'm sure that it's complete coincidence that it's done on the same day that we've got horrendous unemployment figures."
The Conservatives have reiterated their calls for a public inquiry into the causes and conduct of the Iraq war.
At prime minister's questions, shadow foreign secretary William Hague said: "The learning of lessons that may be relevant to Afghanistan and elsewhere can no longer be delayed."
Harriet Harman, standing in for Mr Brown at PMQs, replied that the government had made clear there would be no full inquiry while troops were still in Iraq.
"We have to respect the fact that our fighting forces are still in Iraq. There is no delay," she said.
Liberal Democrat leader Nick Clegg said it was a "huge relief" that the end was "at last in sight".
"There must be a fully independent public inquiry into how this was allowed to happen. The time when Brown has been able to hide behind our troops' ongoing presence in the country is coming to an end," he said.
"The death and injury of hundreds of British troops and hundreds of thousands of Iraqi civilians in this futile war cannot simply be swept under the carpet."
The SNP and Plaid Cymru also called for ministers to set out a timetable for a public inquiry into the war.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.