The Department of Homeland Security announced Tuesday it has increased security at federal buildings across the country, citing terror threats and recent attacks in Canada and elsewhere.

The announcement was made by Homeland Security Secretary Jeh Johnson, who said Federal Protective Service officers are providing the increased security.

Officials said the move was a “precautionary” step and not made in response to any specific threat. But they cited last week’s violence in Canada and Islamic State threats. Additional security will be put in place in Washington, other major U.S. cities and unnamed locations across the country.

“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,” Johnson said in a statement. “Given world events, prudence dictates a heightened vigilance in the protection of U.S. government installations and our personnel.”

A senior U.S. official added: “The Islamic State of Iraq and the Levant and the Nusrah Front have both publicly threatened to retaliate against the West. We are taking all necessary measures to protect U.S. interests overseas and at home.”

More On This...

Johnson also said the increased security will move among locations and will be “continually re-evaluated.”

The changes follows three such attacks last week.

On Wednesday a Canadian soldier was killed when alleged gunman Michael Zehaf-Bibeau stormed the county’s national war memorial and fatally shot a soldier, then entered the Canadian Parliament before being killed by police.

The attack in Ottawa came two days after a man described as an being an Islamic State “inspired terrorist" ran over two soldiers in a parking lot in Quebec, killing one and injuring the other before being shot to death by police.

The man had been under surveillance by Canadian authorities, who feared he had jihadist ambitions and seized his passport when he tried to travel to Turkey.

Muslim leaders say Zehaf-Bibeau once complained that a Canadian mosque he attended was too liberal and inclusive. They also said he was kicked out of the mosque after repeatedly spending the night there against officials’ wishes.

Zehaf-Bibeau’s motive remains unknown, but Canada Prime Minister Stephen Harper has called the shooting a terror attack. And the bloodshed raised fears that Canada is suffering reprisals for joining the U.S.-led air campaign against Islamic State extremists in Iraq and Syria.

Zehaf-Bibeau, whose father was from Libya, was not being watched by authorities. But a top police official said he may have lashed out in frustration over delays in getting his passport.

On Thursday, Zale Thompson, a reclusive Muslim convert who ranted online against America, attacked two New York City police officers on a busy Queens street before being shot down by two uninjured officers.

Thompson has no clear ties to international extremists, and no motive has been established. But city police Commissioner William Bratton is calling the incident a terror attack.

Johnson has said in recent weeks that such lone wolf attacks are now the country’s biggest domestic terror concern. 

A law enforcement source familiar with the terror threat chatter told Fox News that Johnson's latest decision was a "CYA move" since the threats from the Islamic State and other groups have been alarming for some time. 

A former intelligence official also likened Tuesday night's press release to "terror theater," though said it is a good thing to keep the public aware of these threats. 

House Committee on Homeland Security Chairman Michael McCaul said in a statement Tuesday that he "commended" Johnson's decision.

"ISIS is waging a campaign of war over the Internet to incite homegrown violent extremism in the United States," McCaul, R-Texas, said. "We must do everything we can to protect every American abroad and at home."

Fox News’ Jennifer Griffin and Ed Henry contributed to this report.