President Barack Obama said on Thursday he was sending up to 300 U.S. military advisers to Iraq but stressed the need for a political solution to the Iraqi crisis as government forces battled Sunni rebels for control of the country's biggest refinery.

Speaking after a meeting with his national security team, Obama said he was prepared to take "targeted" military action later if necessary, thus delaying but keeping open the prospect of airstrikes to fend off a militant insurgency. But he insisted that U.S. troops would not return to combat in Iraq.

Obama also delivered a stern message to Prime Minister Nouri al-Maliki on the need to take urgent steps to heal Iraq's sectarian rift, something U.S. officials say the Shiite leader has failed to do and which an al-Qaida splinter group leading the Sunni revolt has exploited.