The top U.S. commander in Iraq said Monday that the planned withdrawal of all U.S. combat forces by the end of August could be delayed if conditions worsen in the coming months as Iraqis choose a new government.

WASHINGTON — The top U.S. commander in Iraq said Monday that the planned withdrawal of all U.S. combat forces by the end of August could be delayed if conditions worsen in the coming months as Iraqis choose a new government.

Army Gen. Ray Odierno said his staff had drawn up contingency plans for a delayed withdrawal that he has shared with Pentagon leaders and other U.S. officials during a visit to Washington over the past week. He said he was prepared to make the changes “if we run into problems” but added he was optimistic that would not be necessary.

The United States has about 96,000 troops in Iraq. That’s the lowest number of U.S. forces in the country since the U.S.-led invasion that overthrew dictator Saddam Hussein nearly seven years ago.

Under an agreement negotiated under former President George W. Bush, all combat troops are to leave the country by Aug. 31 although some 50,000 will remain behind to help train Iraqi security forces.

The remaining support troops are to be gone by the end of 2011.

“If you ask me today, I’m fully committed and that’s the right course of action,” Odierno said at the Pentagon.

Shortly after taking office last year, President Obama pledged to pull out all U.S. combat forces from Iraq by the end of August.

At a news conference at the Pentagon, Odierno said he still expected to carry out the original plan but wanted to be prepared if Iraq experiences fresh instability in the aftermath of national elections scheduled for March 7.

“Right now, our plan is to be at 50,000 by the first of September,” he said. “And if you ask me today, I’m fully committed and I believe that’s the right course of action.”

Many Iraqis have said they are worried about a return to widespread sectarian violence as rival factions vie for political control amid the U.S. withdrawal.

Odierno said U.S. forces had not detected a “significant” rise in sectarian violence in recent months, despite anecdotal reports by Iraqis — particularly minority Sunni Muslims — to the contrary. But he allowed that U.S. military officials were concerned about the possibility leading up to the March 7 elections, as well as afterward, when Iraqi politicians are expected to take weeks to haggle over the makeup of a new government.

“If there’s a problem in forming the government, does it translate into violence?” Odierno said. “And right now, we’re not sure. We think so far it will probably go fairly smoothly, but we’ll wait to see.”

When asked whether gays should be allowed to serve openly in the military, Odierno said yes, “as long as we are still able to fight our wars.”

His comment was among the first to come from a senior military leader now leading troops in battle since the Pentagon announced earlier this month that it would study the issue.