President Trump on Thursday signed an executive order to bolster the federal government’s cyber security and protect the country’s cyber infrastructure, White House officials said.

The order prioritized the protection of federal networks, established guidelines for building a better integrated system and directed agencies help centralize risks, said Tom Bossert, the president’s homeland security adviser.

In announcing the executive order at the White House, he said Mr. Trump was keeping “his promise that he made to the American people to keep America safe, including in cyberspace.”

Mr. Bossert said the measures were a response to an increase in cyber attacks in recent years from both foreign governments and non-government actors.

“Sitting by and doing nothing is no longer an option,” he said, an apparent jab at the Obama administration.

However, he said the cyber security effort was not directly tied to allegations that Russia hacked the Democratic National Committee and Hillary Clinton’s campaign during the 2016 presidential election.

“It was not a Russia-motivated issue. It was a United States of America-motivated issue,” Mr. Bossert said.

Despite making enhanced cyber security a top campaign promise, Mr. Trump had delayed taking steps to implement changes. He was set to sign a cyber security order just days after taking office in January but held off to get input from federal agencies and outside experts.

Mr. Bossert said that input came from business and tech industry leaders.

“There’s a lot to be learned from private industry,” he said.

He thanked former New York Mayor Rudy Giuliani, a homeland security expert and campaign adviser to Mr. Trump, for contributing to the plan.

Mr. Bossert also thanked lawmakers who have been working on cyber security, including Republican Sens. John McCain and Richard Burr and Democratic Sen. Sheldon Whitehouse.