FORT HOOD, Texas — Nearly four years after the deadly Fort Hood shooting rampage, the Army psychiatrist charged in the case will finally go on trial after a judge Tuesday refused his request for a three-month delay.

Jury selection in Maj. Nidal Hasan's trial is set for July 9 and is expected to last four weeks. The judge said testimony will start Aug. 6 at the earliest.

Col. Tara Osborn, the judge, said she understands the need for a speedy trial and realizes it has been delayed several times, but said, "The court's paramount concern is that the accused receives a fair trial."

Hasan, 42, requested the delay after the judge earlier this month allowed him to represent himself at the court-martial. Hasan said he needed more time to prepare for his "defense of others" strategy, which must show that a killing was necessary to prevent the immediate harm or death of others.

Last week, Osborn said that defense strategy failed as a matter of law, barring Hasan from telling jurors that he shot U.S. troops because they posed an immediate threat to Taliban leaders in Afghanistan.

Hasan, an American-born Muslim, faces the death penalty or life in prison without parole if convicted in the attack that left 13 dead and nearly three dozen wounded on the Texas Army post.

The issue of whether Hasan will use another defense strategy did not come up during Tuesday's hearing. Military law experts say he might forego a defense theory and just try to make the government prove its case.

Although Hasan will serve as his own attorney, the judge ordered his three former defense attorneys to remain on the case and assist him if he asks.

On Tuesday, former lead defense attorney Lt. Col. Kris Poppe said he and the other attorneys no longer object to serving as Hasan's standby counsel, in light of Osborn's ruling banning Hasan's defense strategy.

Last week, the lawyers said complying with the judge's order to fully assist Hasan would require them to act unethically and said they might ask to withdraw from the case. Hasan said they had refused to give him legal advice about his defense strategy because they opposed it.

Jury selection is to start July 9 but might be put on hold briefly if a jury consultant hired for Hasan's defense has to work on another case for a week. Right now, he's scheduled to be working on another trial in mid-July.

Witnesses have said that after lunch on Nov. 5, 2009, a gunman wearing an Army combat uniform shouted "Allahu Akbar!" — "God is great!" in Arabic — and opened fire in a crowded medical building where deploying soldiers get vaccines and tests. Witnesses said the gunman fired rapidly, pausing only to reload, even shooting at some soldiers as they hid under desks and fled the building.

Hasan's trial initially was set for March 2012. It was delayed two more times because defense attorneys said they needed additional time to prepare, then again last fall because Hasan appealed an order by then-judge Col. Gregory Gross that his beard would be forcibly shaved unless he removed it before trial. Although facial hair violates Army rules, Hasan started growing a beard last summer, saying it was required by his Muslim faith.

Court proceedings resumed in December after the military's highest appeals court ousted Gross from the case and threw out his order.

If Hasan keeps his beard at trial, jurors will be told not to consider his appearance when deciding on a verdict.