US president Barack Obama could veto a bill to lift the ban on out gay soldiers in the military if it contains spending provisions he opposes, his defence secretary said.

Robert Gates, speaking on Fox News Sunday, said the president was against any move by Congress to fund the C-17 cargo plane or an alternate engine for the F-35 Joint Strike Fighter aircraft.

He said: “It would be a very serious mistake to believe that the president would not veto a bill that has the C-17 or the alternative engine in it just because it had other provisions that the president and the administration want.”

When asked whether Mr Obama would veto the bill even if it included provisions to repeal the ban on out gay soldiers, Mr Gates replied: “I think so.”

The gay ban, also known as ‘Don’t Ask, Don’t Tell’, is expected to remain in place until at least next year as a military review is scheduled to last until December.

President Barack Obama pledged to end it in his state of the union address in February.

An estimated 13,000 soldiers have been fired since the law came into effect in 1993.

The majority of military leaders who have spoken publicly about the law support its repeal. However, some oppose lifting the ban and say it will harm morale and recruitment, especially in the middle of two wars.

The law allows gay soldiers to serve in the military but they must not reveal their sexual orientation.