Three US military veterans who were discharged under the law that prohibits gay people from serving openly in uniform sued the government today. They are requesting to be reinstated and putting pressure on lawmakers to repeal the "Don't ask, don't tell" policy before a new Congress is sworn in.

The lawsuit filed in the district court in San Francisco seeks to declare the ban on openly gay troops as unconstitutional and therefore unenforceable.

The air force staff sergeant Anthony Loverde said: "I don't feel like I'm going up against the military, I really don't. I feel like this is a necessary step for doing away with this policy. I believe the military and the majority of troops I've served with are with us."

Loverde, 31, is working in Iraq for a private military contractor providing the army with technical support. The lawsuit was also filed on behalf of the former air force major Michael Almy, 40, and former navy petty officer second class Jason Knight, 28.

The legal action came four days after the Senate blocked a military spending bill, which would have repealed the 17-year-old ban on openly gay troops, for the second time this year.

Senators Susan Collins and Joe Lieberman have introduced a standalone measure, but it is uncertain if it will be brought for a vote before the Senate and house adjourn for the holidays.

Aubrey Sarvis, the director of the Service Members Legal Defence Network, said the lawsuit was meant as a warning to lawmakers that if they don't act to repeal "Don't ask, don't tell," the courts could step in and order an integration timetable that is less to the Pentagon's liking.

Sarvis, whose group co-ordinated and prepared the suit with a private law firm, said: "If the Senate fails to act in the lame duck session, we are prepared to litigate this aggressively." He added: "From my perspective, this is the first shot over the bow."

The move also was aimed at validating the concerns of the defence secretary, Robert Gates, a named defendant in the suit, along with navy and air force chiefs.

A Pentagon study published this month found that two-thirds of troops thought repealing the gay ban would have little effect on their units. Gates then joined the president, Barack Obama, in urging the Senate to end "Don't ask, don't tell."

He reiterated last Friday that if lawmakers do not act, military leaders could end up "at the mercy of the courts and all of the lack of predictability that entails".

A federal judge in Riverside, California, ruled in a different lawsuit in September that the gay ban violated the due process and free speech rights of gay Americans.

The district judge Virginia Phillips issued a worldwide injunction immediately stopping enforcement of the ban, but the 9th US circuit court of appeals suspended her order.

The suit filed on Monday makes the same constitutional claims – rooted in a 2003 US supreme court position – that private and consensual homosexual activity cannot be outlawed.

It also relies on a 2008 decision from the 9th circuit that the air force violated the civil rights of flight nurse Margaret Witt when it fired her under "Don't ask, don't tell" without demonstrating she needed to be removed to protect her reserve unit's cohesion or readiness.

Lawyers for the three plaintiffs in the current suit will contend that allowing gay service members to serve openly strengthens the armed forces by not requiring them to keep their sexual orientation a secret.

Almy, a decorated officer who was in the Senate chambers last week when Republicans refused to let the repeal measure advance, said he still hopes lawmakers can be persuaded to take up the standalone bill, even if it means postponing their holidays.

Almy is the son of an air force officer who did not know he was gay. He was discharged in 2005 after another member of the air force searched his computer files and found a private email Almy had written to another man when he was in Iraq. His 13-year career ended with him being given a police escort off the base.

"I spent four Christmases deployed in the Middle East," he said. "If we can make that kind of sacrifice for our nation, certainly our senators can give up a Christmas to get this done."