(CNN) -- Sen. Barack Obama called the war in Iraq a "dangerous distraction" Tuesday and said more emphasis must be placed on the battle in Afghanistan.

Sen. Barack Obama said he would take the country in a new direction, should he become president.

"As should have been apparent to President Bush and Sen. [John] McCain, the central front in the war on terror is not Iraq, and it never was," Obama said in what his campaign called a major policy address on Iraq, Afghanistan and national security.

Obama said that part of his new strategy will be "taking the fight to al Qaeda in Afghanistan and Pakistan."

Shortly after Obama's speech, McCain attacked the Illinois senator's opposition to the surge policy in Iraq and highlighted his own proposal for victory in Afghanistan. Read what McCain says about Obama's plan

"Sen. Obama is departing soon on a trip abroad that will include a fact-finding mission to Iraq and Afghanistan. And I note that he is speaking today about his plans for Iraq and Afghanistan before he has even left, before he has talked to Gen. [David] Petraeus, before he has seen the progress in Iraq and before he has set foot in Afghanistan for the first time," McCain said.

"In my experience, fact-finding missions usually work best the other way around: First, you assess the facts on the ground; then you present a new strategy."

Obama said that on his first day in office he would give the military a new mission: ending the war in Iraq.

Pointing to Prime Minister Nuri al-Maliki's recent call for a timetable, Obama said "now is the time for a responsible redeployment of our combat troops that pushes Iraq's leaders toward a political solution, rebuilds our military, and refocuses on Afghanistan and our broader security interests."

Obama's speech, given at the Ronald Reagan Building and International Trade Center in Washington, comes one day after he detailed his plan for Iraq in a New York Times opinion piece.

Sources familiar with Obama's plans said the candidate will travel to the war-torn country this month with two Senate colleagues, Republican Chuck Hagel and Democrat Jack Reed.

"This war distracts us from every threat that we face and so many opportunities we could seize. This war diminishes our security, our standing in the world, our military, our economy, and the resources that we need to confront the challenges of the 21st century," Obama said. Watch Obama explain why the war 'distracts' »

"By any measure, our single-minded and open-ended focus on Iraq is not a sound strategy for keeping America safe."

Obama blasted the Bush administration for missed opportunities in the aftermath of the September 11 terrorist attacks.

"Imagine, for a moment, what we could have done in those days, and months, and years after 9/11," he said.

Obama said the country could have hunted down Osama bin Laden, al Qaeda, the Taliban and terrorists responsible for the attacks. He said billions of dollars could have been invested in alternative sources of energy to "end the tyranny of oil," and partnerships with alliances could have been strengthened, among other things.

"Instead, we have lost thousands of American lives, spent nearly a trillion dollars, alienated allies and neglected emerging threats -- all in the cause of fighting a war for well over five years in a country that had absolutely nothing to do with the 9/11 attacks," he said.See where the candidates stand on Iraq

He said his strategy rests on five goals: "ending the war in Iraq responsibly, finishing the fight against al Qaeda and the Taliban, securing all nuclear weapons and materials from terrorists and rogue states, achieving true energy security and rebuilding our alliances to meet the challenges of the 21st century."

Obama has faced accusations that he has shifted his policy on Iraq. He told reporters questioning his stance this month that he will "continue to refine" his policies as warranted.

Obama supports a phased withdrawal of troops. He says he'd remove all combat brigades from Iraq within 16 months of taking office if he becomes president.

McCain does not think American troops should return to the United States until Iraqi forces are capable of maintaining a safe, democratic state.

He has been a strong advocate of the "surge" -- the 2007 escalation of U.S. troops -- and says troops should stay in Iraq as long as needed. McCain says Obama is wrong for opposing the increased troop presence, and Obama says McCain's judgment is flawed.

A new Washington Post-ABC poll shows that the country is split between those backing Obama's timeline for withdrawal and those who agree with McCain's stance that events should determine how troops are handled.

The poll found 50 percent support a timetable, compared with 49 percent who do not.

The poll was conducted by phone on July 10-13. It sampled 1,119 people and has a margin of error of plus or minus 3 percentage points.