By Jennifer Loven, Ap White House Correspondent – 1 hr 9 mins ago BAGHDAD – Cheered wildly by U.S. troops, President Barack Obama flew unannounced into Iraq on Tuesday and promptly declared it was time for Iraqis to "take responsibility for their country" after America's commitment of six years and thousands of lives. "You have given Iraq the opportunity to stand on its own as a democratic country," the president said as he made a brief inspection of a war he opposed as candidate and now vows to end as commander in chief. "That is an extraordinary achievement." A total of 4,265 U.S. troops have lost their lives in Iraq since March 2003, and Obama said American forces had "performed brilliantly ... under enormous strain." "It is time for us to transition to the Iraqis," he said as an estimated 600 troops cheered. "They need to take responsibility for their country." Obama also met with Iraqi Prime Minister Nouri al-Maliki, who said afterward that he had "assured the president that all the progress that has been made in the security area will continue." Obama said he had "strongly encouraged" the Iraqi leader to take steps to unite political factions, including integrating Sunnis into the government and security forces. Obama flew into Iraq shrouded by secrecy and was shielded by heavy security from the moment he stepped off a gleaming white and blue Air Force One. The plane touched down a few hours after a car bombing in a Shiite neighborhood of the capital city punctuated a recent surge in violence in the war-ravaged country. Many thousands of Iraqis have died in the six years of war in addition to the American losses. Obama spoke favorably of political progress but also expressed concern that recent gains could deteriorate with the upcoming national elections. "It's important for us to use all of our influence to encourage the parties to resolve these issues in ways that are equitable. I think that my presence here can help do that," he said. Obama wore a business suit as he descended the steps of his plane after a flight from Turkey. He shook hands with Gen. Ray Odierno, the top U.S. commander in the country, then stepped into an SUV for a brief ride to Camp Victory, the main American military base in Iraq. Under gray skies, the motorcade rolled past troops standing at attention. "It was wonderful to see the troops out there," Obama said. "I'm so grateful, they put their heart and souls into it." Inside a marble palace, he was interrupted repeatedly with cheers from the troops. "I love you," someone in the crowd shouted out. I love you back," the commander in chief replied. Scores of troops held digital cameras above their heads, snapping pictures and recording video of a day they would long remember. Aides decided to scrap plans for a helicopter ride to the heavily fortified Green Zone a few miles away — but attributed the decision to poor visibility rather than security concerns. En route to Baghdad, White House press secretary Robert Gibbs said Obama chose Iraq rather than Afghanistan for a war-zone visit in part because it was near Turkey and also because progress "lies in political solutions." "We spend a lot of time trying to get Afghanistan right, but I think it is important for people to know that there is still a lot of work to do here," Obama said. Obama's visit came at the conclusion of a long overseas trip that included economic and NATO summits in Europe and two days in Turkey. Shortly before leaving Turkey, the president held out Iraq as an example of the change he seeks in policies inherited from former President George W. Bush. "Moving the ship of state takes time," he told a group of students in Istanbul. He noted his long-standing opposition to the war, yet said, "Now that we're there," the U.S. troop withdrawal has to be done "in a careful enough way that we don't see a collapse into violence." In office only 11 weeks, Obama has already announced plans to withdraw most U.S. combat troops on a 19-month timetable. The drawdown is to begin slowly, so American forces can provide security for Iraqi elections, then accelerate in 2010. As many as 50,000 troops are expected to remain in the country at the end of the 19 months to perform counterterrorism duties. Tuesday's trip was Obama's third to Iraq, and his first since taking office. He met with U.S. commanders and troops last summer while seeking the presidency. It was the last stop of an eight-day trip to Europe and Turkey during which Obama sought to place his stamp on U.S. foreign policy after eight years of the Bush administration. He and other world leaders pledged cooperation to combat a global recession, and he appealed with limited success for additional assistance in Afghanistan, a war he has vowed to intensify. The new president drew large crowds as he offered repeated assurances that the United States would not seek to dictate to other countries. "I am personally committed to a new chapter of American engagement. We can't afford to talk past one another, to focus only on our differences, or to let the walls of mistrust go up around us." Obama said before leaving Turkey. The visit to a nation that straddles Europe and Asia was designed to signal a new era. He had pledged as a candidate to visit a majority-Muslim nation in his first 100 days in office. Bush paid several trips to Iraq while in office, and on his last, in December, he was forced to duck shoes hurled in his direction at a news conference by an Iraqi journalist. By coincidence, the Iraqi Supreme Court reduced the prison sentence Tuesday for the man, Muntadhar al-Zeidi, now sentenced to one year in jail rather than three. While U.S. casualties are down sharply from the war's height, there were constant reminders of violence in Iraq. A half-dozen bombs rocked Shiite neighborhoods on Monday, killing 37 people. At least nine people died in the car bombing that occurred a few hours before the president arrived on Tuesday. The military is in the process of thinning out its presence ahead of a June 30 deadline, under a U.S.-Iraq agreement negotiated last year that requires all American combat troops to leave Iraq's cities. As that process moves forward, the increase in bombings and other incidents is creating concern that extremists may be regrouping. Little more than a week ago, the president announced a revamped Afghanistan strategy that calls for adding 21,000 troops, narrowing the focus from nation-building to stamping out the Taliban and al-Qaida and broadening the mission to include pressure on Pakistan to root out terrorist camps in its lawless regions. Afghanistan was a big topic of conversation with fellow world leaders on the earlier portion of Obama's trip, particularly the part that took him to a NATO summit in Strasbourg, France. Obama's opposition to the Iraq war helped him enormously in his campaign for the presidency. It helped him defeat former rival — now Secretary of State — Hillary Rodham Clinton in the Iowa caucuses that were the first test of the race, and aided his campaign against Republican Sen. John McCain last fall. The end-the-war plan Obama announced in February was aimed at fulfilling his campaign promise to end combat in Iraq within 16 months of taking office. Contrary to hopes among some Democrats and grass-roots supporters, the plan calls for a 19-month timetable instead.