The Department of Homeland Security on Tuesday announced heightened security measures at federal buildings in the District and nationwide, citing the recent shooting at the Canadian Parliament and threats from terrorist groups to attack the homeland.

DHS officials emphasized that the step was precautionary and not based on any intelligence about a specific terrorist plot. Rather, they said, the shootings in Canada and other events such as the ongoing U.S. bombing campaign in Iraq and Syria dictated that more security would be a wise measure. The increased security started over the weekend but was only announced Tuesday because of its sensitivity, they said.​

“This is a precautionary step to safeguard U.S. government personnel and facilities, and the visitors to those facilities,’’ said a senior DHS official, who spoke on condition of anonymity to discuss internal deliberations. The changes are “not based on any specific, credible information at this time indicating any active plot against government officials and law enforcement in the United States.’’

Department of Homeland Security Secretary Jeh Johnson announced heightened security at federal buildings nationwide on Tuesday. (AP/Manuel Balce Ceneta)

In announcing the raised security alert, DHS Secretary Jeh Johnson said: “The reasons for this action are self-evident: the continued public calls by terrorist organizations for attacks on the homeland and elsewhere, including against law enforcement and other government officials, and the acts of violence targeted at government personnel and installations in Canada and elsewhere recently. ‘’

“Given world events,’’ Johnson said, “prudence dictates a heightened vigilance in the protection of U.S. government installations and our personnel.

Johnson and other officials would not detail the new security measures or which government buildings will be affected, other than saying they will be buildings in D.C. and other major cities and locations around the country. “The precise actions we are taking and the precise locations at which we will enhance security is law-enforcement sensitive, will vary and shift from location to location, and will be continually re-evaluated,’’ Johnson said.

The DHS action, which will be carried out by the Federal Protective Service — which guards more than 9,500 federal facilities passed through by 1.4 million visitors or occupants daily — followed last week’s shocking violence in Canada. In Ottawa, the capital, a gunman killed an honor guard soldier and then opened fire inside the nearby Parliament building.

Gunfire rocked the core of Canada’s government and set off a chaotic scene across downtown Ottawa, in a country that rarely sees gun violence.

President Obama condemned the violence, saying “Obviously we’re all shaken by it.”