Attorney General William Barr notified federal agents and lawyers Wednesday that they cannot open investigations of presidential candidates, their campaigns, or advisers without his approval.

His directive follows a report by the Justice Department's inspector general that harshly criticized the FBI's investigation of the 2016 Trump campaign. It recommended an evaluation of the kind of sensitive matters that should require high-level approval, particularly those involving politics.

Barr told NBC News in December that "there has to be some basis before we use these very potent powers in our core First Amendment activity." He suggested in January that changes were coming, saying at a news conference that he and FBI Director Chris Wray agreed that opening a counterintelligence investigation of a presidential campaign "would be something that the director of the FBI would have to sign off on and the attorney general would have to sign off on."

In his memo, Barr said the Justice Department must respond when faced with credible threats to campaigns. But he said that "the existence of a federal criminal or counter-intelligence investigation, if it becomes known to the public, may have unintended effects on our elections."

Under the new rules, no investigation can be opened of a declared candidate for president or vice president, their campaigns, or senior staff members without consulting with the appropriate U.S. attorney and getting approval of the attorney general. Investigations of candidates for U.S. Senate or House require notifying and consulting with an assistant attorney general, as do investigations of potentially illegal foreign campaign contributions.

Barr said the requirement would be in place through the 2020 election season. Afterward "the department will study its experiences and consider whether changes to the requirements are necessary."

In his report on the FBI's handling of the Trump investigation, Inspector General Michael Horowitz said he was surprised to discover that rules then in existence did not require approval or even consultation with the Justice Department before opening an investigation "of individuals associated with a major presidential campaign."