(CNN) -- A judge on Thursday denied a request for President Barack Obama to testify at a court martial for a U.S. Army flight surgeon who refused to deploy to Afghanistan until he saw proof that Obama was born in the United States.

The judge, Army Col. Denise Lind, said any evidence or witnesses related to Obama's citizenship is irrelevant to the charges against Lt. Col. Terrence Lakin, who has 17 years of service in the U.S. military.

After failing to deploy with his unit in April, Lakin was charged with missing a movement, disobeying a lawful order and dereliction of duty.

The Uniform Code of Military Justice says the maximum punishment for both offenses -- missing his plane and disobeying lawful orders -- is a dishonorable discharge and up to two years in confinement. A guilty verdict could also result in forfeiture of Lakin's pay, which totals $7,959 a month, according to a charge sheet provided by a group sponsoring his defense.

Lakin's lawyers argued that all military orders stem from the commander-in-chief. Without evidence that Obama is eligible to be president, they say, the doctor's deployment order was illegal.

In addition to putting Obama on their witness list, Lakin's lawyers had asked Lind to order Obama's official birth records from Hawaii be brought to court for trial.

"If the president is ineligible, you need to know that," Lakin's civilian attorney, Paul Jensen, told Lind. "Col. Lakin needs to know that, the government needs to know that, America needs to know that."

The prosecutors in the case argued that Obama's eligibility is not relevant because the officers who ordered Lakin to go to Fort Campbell and then ordered him to answer questions about why he didn't go were his proper superiors in the military chain of command, and they gave him legal orders. Jensen later conceded that point.

The judge ruled that the matter of Obama's eligibility is not relevant because he did not give any orders in the case. She pointed out that while the president is commander-in-chief of the military, it is Congress that is constitutionally empowered to raise armies, pay them and equip them.

Any contention that any orders are invalid if the president is ineligible "is erroneous," the judge said.

Lind also said that military law says that a soldier's personal beliefs or convictions are not sufficient to allow that soldier to determine that an order is illegal. The soldier has to have "no rational doubt" that the order is illegal before he or she can ignore it.

Finally she ruled that a military court martial is not the forum in which to determine a president's eligibility, because the Constitution says only Congress has the power to impeach and remove the president.

Afterward, Jensen said he respected the judge's ruling, but called it distressing.

"It completely deprives us of any opportunity to present a defense in this case," Jensen said.

The court martial is set to begin in October, but Jensen said he's not giving up on the matter of Obama's eligibility.

"We will be giving the Army Court of Criminal Appeals in the next week or two the opportunity to take up the issue, and we are going to fight on for justice to be served in this case."

Lakin is among 27 percent of Americans who doubt or deny that Obama is American-born, according to a recent CNN/Opinion Research Corp. poll. They compose the birther movement, which demands that Obama present a birth certificate signed by the doctor who delivered him in 1961.

CNN and other news organizations have thoroughly debunked the rumors about the president's birthplace. The Obama campaign released a copy of a birth record issued by the state in 2007, called a "certification of live birth," and allowed reporters to examine the document in person in 2008.

Last year, Hawaiian state officials issued a statement that they had personally viewed the president's original Hawaiian birth record, called a "certificate of live birth," and verified it to be authentic. State law bars the release of the original certificate. In addition, two Hawaiian newspapers ran notices in 1961 announcing Obama's birth in the state.

CNN's Larry Shaughnessy contributed to this report