CAMP LEJEUNE, North Carolina (Reuters) - President Barack Obama said on Friday he would pull U.S. combat troops out of Iraq in 18 months as he unveiled a new strategy that stressed diplomacy and engagement with foes like Iran and Syria.

Winding down the Iraq war will allow Obama to boost troop numbers in Afghanistan, which he has declared the central front in the U.S. fight against terrorism. He hopes it will also help him slash a ballooning $1.3 trillion budget deficit.

We are leaving Iraq to its people, and we have begun the work of ending this war, Obama said, almost six years after U.S.-led forces toppled Saddam Hussein in a vain hunt for weapons of mass destruction.

The 18-month timetable marks a historic juncture in a war that has been enormously costly to the United States and defined the presidency of George W. Bush. It has been a huge drain on the Treasury, cost the lives of 4,250 U.S. soldiers and damaged the United States' standing in the world.

I have chosen a timeline that will remove our combat brigades over the next 18 months. Let me say this as plainly as I can: by August 31, 2010, our combat mission in Iraq will end, Obama said to scattered applause from an audience of about 2,000 Marines at Camp Lejeune in North Carolina.

Obama said 35,000 to 50,000 troops would stay to train and equip the Iraqi forces, protect civilian reconstruction projects and conduct limited counterterrorism operations.

He stressed he intended to remove all U.S. troops by the end of 2011, in line with a deal signed with Iraq last year, and in a direct address to the Iraqi people said the United States pursues no claim on your territory or your resources.

Defense Secretary Robert Gates said he would favor a modest U.S. military presence in Iraq even after the end of 2011 to assist Iraqi security forces if requested by Baghdad.

My own view would be that we should be prepared to have some very modest-sized presence for training and helping them with their new equipment and providing perhaps intelligence support, he told reporters.

PURSUING DIPLOMACY

Obama said Washington would pursue a regional diplomatic strategy, help resettle millions of Iraqis displaced by violence, and try to help Iraq's leaders resolve divisive political issues.

The United States will pursue principled and sustained engagement with all of the nations in the region, and that will include Iran and Syria, he said.

Washington has accused Iran and Syria of meddling in Iraq's internal affairs, a charge they deny. The Bush administration pursued talks with Tehran on stabilizing Iraq but they petered out in the midst of mutual accusations.

Obama said the U.S. troop drawdown sent a clear signal that Iraq's future is now its own responsibility.

We cannot sustain indefinitely a commitment that has put a strain on our military, and will cost the American people nearly a trillion dollars, he said.

For many Americans, the Iraq war has been overshadowed by a deep recession that has left many struggling to make ends meet and millions jobless.

Obama's decision to leave a sizable force to bolster stability was welcomed by congressional Republicans, notably former presidential candidate Senator John McCain, while some Democrats were concerned too many troops would remain in Iraq.

Overall it is a reasonable plan and one that can work and I support it, said McCain, who had argued Obama was naive on national security and criticized his 16-month withdrawal plan.

In an effort to stem rising violence in Afghanistan, Obama ordered 17,000 more troops, including Marines from Camp Lejeune, to Afghanistan last week.

Obama, who accused the Bush administration of becoming distracted by the Iraq war and allowing security to deteriorate in Afghanistan, briefed Bush on his speech on Friday. (Additional reporting by Andy Gray, Thomas Ferraro, Susan Cornwell and Steve Holland; Editing by Doina Chiacu)