Republican Senator John McCain issued a statement last night disagreeing with President Barack Obama’s pledge to repeal the military gay ban.

McCain, the 2008 Republican presidential candidate, said he believed it would be a “mistake” to repeal the law in the middle of two foreign wars.

Obama said last night in his State of the Union address that he would work with Congress and the military this year to remove the ban, in line with his election campaign promise. The law means gays and lesbians can be fired if their sexual orientation is revealed.

McCain said: “I am immensely proud of, and thankful for, every American who wears the uniform of our country, especially at a time of war, and I believe it would be a mistake to repeal the policy.

“This successful policy has been in effect for over 15 years, and it is well understood and predominantly supported by our military at all levels.

“We have the best trained, best equipped, and most professional force in the history of our country, and the men and women in uniform are performing heroically in two wars.

“At a time when our Armed Forces are fighting and sacrificing on the battlefield, now is not the time to abandon the policy.”

Obama has already faced a battle with Republicans over his controversial healthcare bill.

Republican Scott Brown won a surprise victory in Massachusetts last week and some party members have predicted the Republicans may get control of the House in November.

Last week, McCain’s wife Cindy and daughter Meghan posed for campaign photos for NOH8, a group fighting to repeal the gay marriage ban in California.

While Meghan McCain has been a keen supporter of gay rights, her mother’s support came as a surprise and led some to speculate whether the McCains are more pro-gay than the Obama family.