John M. Roll, the chief federal judge in Arizona, was fatally wounded in the attack near Tucson on Saturday that killed five others and wounded at least 18 people, including Representative Gabrielle Giffords.

“We’re all in kind of a state of shock here,” said Richard H. Weare, the clerk of the Federal District Court for Arizona, after hearing from the Federal Marshals Service, which confirmed the death.

President Obama praised Judge Roll as a jurist “who has served America’s legal system for almost 40 years.”

Judge Roll was appointed by the first President George Bush in 1991 and has been chief judge since 2006. His district is part of the sprawling Ninth Circuit, which covers federal courts throughout the West. He served as a state judge and as an assistant United States attorney for Arizona before he was appointed to the federal bench.

The chief judge of the United States Court of Appeals for the Ninth Circuit, Alex Kozinski, described Judge Roll as a tireless advocate for his district: “Of all the chief judges of the circuit, I must say he was always the hardest working — always looking out for his district. He’ll be a great loss to his family, but he’ll also be a great loss to the federal judiciary.”

He said Judge Roll was a good friend who sought increased federal resources for his district, which had seen a surge in felony cases related to drugs and crime along the border with Mexico.

Judge Roll was no stranger to the risks of public service. He and his wife were provided protection by the Federal Marshals Service in 2009 in connection with a case in which a group of Mexicans sued an Arizona rancher for $32 million. They accused the rancher of civil right abuses for stopping people at gunpoint as they crossed his land and then turning them over to the Border Patrol.

After Judge Roll ruled that the case could go forward, he received death threats. Judge Roll told The Arizona Republic that the situation was “unnerving and invasive.”