The special agents who protect congressional leaders are a constant, anomalous presence in the Capitol, a suit-wearing, grim-visaged, hand gun-carrying force that follows at least the top nine members of the federal legislative branch as they travel to, from and in Washington and their home districts or states. They have the same duties as their counterparts in the executive branch, the Secret Service, and none of the publicity.

But in extraordinary circumstances — such as the Flag Day shooting of House Majority Whip Steve Scalise, along with a current and a former staffer — details about their work flash into public view.

Sen. Orrin G. Hatch, president pro tempore of the Senate, in a speech Wednesday said 23 armed guards protect him and his wife around the clock in and around the Capitol and beyond. “These men and women are like family to me,” the Utah Republican said. “Over the past two and a half years, I’ve built a special bond with each of them.” Before he named each of the agents, Hatch singled out David Rib as the supervisory special agent, as well as Jason Marcello and Shane Powell as the team leaders.

Having the security detail is a source not only of emotional succor for Hatch and his staff but also of pride. Hatch spokesman Matt Whitlock said in an email, “We can’t say much about it apart from the fact that he has it because he’s third-in-line to the Presidency, and his detail is the second largest on the Hill following Speaker Ryan.”

Like David Popp, communications director for Senate Majority Leader Mitch McConnell, Ryan spokeswoman Molly Edwards did not so much as acknowledge whether Ryan has security detail. Edwards said their office does not discuss security-related issues and referred questions to Capitol Police.

At least one aide to a congressional leader disclosed details of his boss’ security team. Sen. John Cornyn, the majority whip, has a security detail of five armed guards, according to an aide speaking on condition of anonymity. Some of the special agents protect the Texas Republican in and around his leadership office, while others are in his Senate office. The agents travel with Cornyn while he travels to, in and from Texas.

Over at the House, the press secretaries for Majority Leader Kevin McCarthy, Minority Leader Nancy Pelosi and Minority Whip Steny H. Hoyer confirmed that their bosses have security detail, but did not provide further information.

A spokeswoman for Senate Minority Whip Richard J. Durbin did not return a phone call.

An aide to South Carolina Rep. James E. Clyburn, the assistant Democratic leader, said in an email that Clyburn does not have security detail.

The history of congressional leaders having the protection of armed guards is murky. Few details about the budget of the Capitol Police are released publicly. The Senate Historical Office referred a reporter’s questions about congressional security to a recent story by another publication.

Not until 1971 did Congress make it a federal crime to assault, kidnap or kill a member; for example, Sirhan Sirhan, the assassin of Sen. Robert F. Kennedy, was prosecuted in California state court in 1968.

When Mississippi Sen. John C. Stennis, chairman of the Armed Services Committee, was shot and robbed outside his home in northwest Washington in January 1973, he had no security.

Rep. Leo J. Ryan, a California Democrat, had no congressional or Secret Service detail when he traveled to Guyana for his investigation of the Peoples Temple religious cult in November 1978. Ryan told his administrative assistant Galen W. “Joe” Holsinger he considered bringing a handgun, but kept his at home after concluding he would be outgunned by armed guards of cult leader Jim Jones. Ryan was assassinated on a dusty, remote airstrip in Port Kaituma while escorting 13 defectors to safety.

Most congressional observers have said the number of security personnel increased after September 11, 2001. Ron Bonjean, a spokesman for House Speaker J. Dennis Hastert in the late 1990s and for Senate Majority Leader Trent Lott in the early 2000s said before 9/11, “It was a much more relaxed police presence, like all security measures around the Capitol.” Then two airplanes struck the Twin Towers in New York City and with another reportedly headed for the Capitol, Bonjean remembers a vivid scene inside Lott’s leadership office. “His detail burst into his office and got him out of there,” Bonjean said.

Direct attacks on members of Congress have been rare. Official records suggest there have been at least 21 instances of attacks involving 24 members who were targeted by assailants, according to a 2011 report from the Congressional Research Service. The report noted more than 12,000 people have been members.

Pelosi said rank-and-file Democrats have not asked her for more security personnel, but she would like to see their numbers increase. “I think we can give them more resources,” she said.

Capitol Police Chief Matthew R. Verderosa did not respond to phone and email messages for comment. Instead, communications director Eva Malecki referred a reporter to his statement about the shootings Wednesday: “The United States Capitol Police will continue to provide a robust and visible presence across the Capitol complex, and monitor national and world events to provide the level of security required to protect the U.S. Capitol and members of Congress.”

Correction: An earlier version of this story misstated Popp's title. He is the communications director for McConnell.