BAGHDAD, April 7 — President Obama declared Tuesday that Iraqis “must take responsibility for their country” and predicted that the next 18 months will be trying as U.S. troops start to leave a country stymied by security threats and political problems.