Outgoing Chief Judge Royce Lamberth sheds a tear during a ceremony honoring him for his service at the U.S. District Court for the District of Columbia on Monday in Washington. (Ricky Carioti/The Washington Post)

He’s thrown D.C. corrections officials in jail, held Cabinet secretaries in contempt and threatened to cover a defendant’s mouth with duct tape. He called a federal agency a dinosaur and city officials bullheaded.

Royce C. Lamberth, a shoot-from-the-hip Texan known for taking a hard line against what he sees as government incompetence, formally stepped down Tuesday as chief judge of the District’s federal court.

Lamberth is also known as a genial giant of a public servant, a trusted adviser, and a friend to an extensive network of lawyers, judges and clerks from all corners of the city’s legal community. He plays poker with conservatives on the Supreme Court, including Chief Justice John G. Roberts Jr., and he counts the District’s longtime federal public defender, A.J. Kramer, as a close friend.

And since his appointment to the bench by President Ronald Reagan in 1987, Lamberth has had a hand in a long list of cases of national significance. He oversaw the controversial Foreign Intelligence Surveillance Court after the Sept. 11, 2001, terrorist attacks, and he has ruled on the treatment of Guantanamo Bay detainees and the funding of human embryonic stem cell research.

Lamberth, who turned 70 on Tuesday, was required to resign because of his age. After five years as chief, he passed the gavel to U.S. District Judge Richard W. Roberts, who told Lamberth that he had “left some Texas-sized shoes to fill.”

His “low tolerance for incompetence,” as his administrative assistant Sheldon Snook put it, comes in part from the importance he places on the role of government service.

Lamberth, the valedictorian at his San Antonio high school, came to Washington during college, where he worked summer nights as a Howard Johnson’s waiter and spent his days dropping in on congressional hearings. He served in Vietnam in the Judge Advocate General’s corps and led the civil division of the District’s U.S. attorney’s office for nine years.

On the bench, he quickly developed a reputation for sending strong messages.

In the 1990s, he jailed two city prison officials after finding that they had retaliated against a female guard who had complained about sexual harassment. The officials had acted “arrogantly” and “bullheadedly,” he said.

In the waning days of President Bill Clinton’s administration, Lamberth faulted the Environmental Protection Agency, then headed by Carol Browner, for “egregious” inattention when it disregarded his order to retain records on new environmental rules.

U.S. District Judge Amy Berman Jackson made light of Lamberth’s use of his contempt powers when she belted out a parody of the tune “My Way” at his celebration.

In recent days, as his transition approached, Lamberth has made a point to defend the FISA court, which has been criticized because it rarely rejects the government’s private requests for electronic surveillance.

“These are the kinds of things we should be doing to protect our country,” he said. “We have to rely on electronic surveillance to find out what the enemy is up to.

“No one calls me a rubber stamp for the government,” he said.

In fact, Lamberth challenged the Bush administration before his term leading the secret court expired in 2002, saying that the government misled the court dozens of times in applications for search warrants and wiretaps. He also rejected the Justice Department’s request for new powers.

Even after he left the FISA court, Lamberth’s colleagues sought his counsel. When Judge Colleen Kollar-Kotelly took over as chief in 2002, she was given a classified briefing on President George W. Bush’s secret and warrantless surveillance program and was instructed by the National Security Agency’s director not to discuss the program with fellow judges.

Kollar-Kotelly insisted that she be allowed to consult with Lamberth, according to two people familiar with her request. The administration agreed that she could, according to an unredacted version of the NSA inspector general’s report.

Lamberth’s straight talk has gotten him in trouble. His frustration with the Interior Department’s failure to properly account for money long owed to Native Americans prompted him to hold two Cabinet secretaries in contempt and order sanctions against agency lawyers.

He compared the department to a dinosaur and called it “the morally and culturally oblivious hand-me-down of a disgracefully racist and imperialist government.”

His language was so strong that Lamberth was taken off the case by an appeals court in 2005, after the Justice Department took the unusual step of requesting his removal.

In retrospect, Lamberth said he regrets what he described as his “intemperate” language. But he added that just because the appeals court’s decision was final, “it doesn’t mean they are right.”

At the insistence of his wife, Janis, Lamberth cleared piles of court papers from his desk in preparation for his transition to a senior judge, in which he will take a reduced caseload. He’ll also spend two months of the year hearing cases in San Antonio.

Lamberth’s sly sense of humor created a minor stir Monday when he reminded well-wishers that he was rejoining the court’s rotation for case assignments. Lamberth closed his remarks by joking about the possibility of a federal case against Mayor Vincent C. Gray (D).

“I could draw anything, including the mayor,” he said.

With the audience chuckling, Lamberth added: “Oops — I don’t know anything about that.”

At Lamberth’s celebration was U.S. Attorney Ronald C. Machen Jr., who has been investigating an alleged off-the-books shadow campaign for Gray by D.C. businessman Jeffrey E. Thompson. Neither Thompson nor Gray has been charged.

When asked to comment on Lamberth’s joke, Machen gave a smile but declined.