WASHINGTON (AP) — Attorney General William Barr declared Wednesday he thinks "spying did occur" on Donald Trump's presidential campaign, suggesting the origins of the Russia investigation may have been mishandled and aligning himself with the president at a time when Barr's independence is under scrutiny.

Barr, appearing before a Senate panel, did not say what "spying" had taken place but seemed likely to be alluding to a surveillance warrant the FBI obtained on a Trump associate. He later said he wasn't sure there had been improper surveillance but wanted to make sure proper procedures were followed. Still, his remarks give a boost to Trump and his supporters who insist his 2016 campaign was unfairly targeted by the FBI.

Barr was testifying for a second day at a congressional budget hearing that was dominated by questions about special counsel Robert Mueller's Trump-Russia investigation. His comments risked inflaming Democratic concerns that Barr's views are overly in sync with Trump's and that he's determined to protect the president as he readies the release of a version of Mueller's report.

Barr said he expects to release a redacted copy of the report next week. Democrats have expressed concern that his version will conceal wrongdoing by the president and are frustrated by the four-page summary letter he released last month that they say paints Mueller's findings in an overly favorable way for the president.

Democrats immediately seized on Barr's testimony.

House Judiciary Committee Chairman Jerrold Nadler, D-N.Y., tweeted that Barr's comments "directly contradict" what the Justice Department previously had said, and he said he had requested a briefing from the department. House intelligence committee Chairman Adam Schiff, D-Calif., said Barr's comments were sure to please Trump, "but it also strikes another destructive blow to our democratic institutions."

Republicans, meanwhile, praised Barr for looking into the matter. North Carolina Rep. Mark Meadows, a confidant to Trump who has raised concerns about Justice Department conduct for the past two years, tweeted that Barr's willingness to investigate it is "massive."

Barr, who was nominated to his post by Trump four months ago, was asked about spying by Republican Sen. Jerry Moran. He said that though he did not have specific evidence of wrongdoing, "I do have questions about it."

"I think spying on a political campaign is a big deal," Barr said.

Democratic Sen. Jeanne Shaheen asked him directly if he believed spying on the campaign occurred, and he said, "Yes I think spying did occur. The question is whether it was adequately predicated" — meaning whether it was legally justified.

Barr said he was reviewing his department's actions in investigating Trump. A separate investigation is being conducted by the Justice Department inspector general into the early days of the FBI's Russia probe, which Barr said he expects to conclude sometime around May or June.

"I feel that I have an obligation to ensure government power was not abused," Barr said.

Asked again about spying at the end of the hearing, Barr tempered his tone. "I am not saying improper surveillance occurred. I am saying I am concerned about it, and I am looking into it," he said.

Barr's reference to "spying" may refer to a secret surveillance warrant that the FBI obtained in the fall of 2016 to monitor the communications of former Trump campaign aide Carter Page, who has not been charged with any wrongdoing and has denied being a Russian spy.

That warrant included a reference to research that was conducted by an ex-British spy who was funded by Democrats to look into Trump's ties to Russia.

Critics of the Russia investigation say the warrant on Page was unjustified and have also seized on anti-Trump text messages sent and received by one of the lead agents involved in investigating whether the Trump campaign was colluding with Russia.

At the White House on Wednesday, Trump repeated his claim that the investigation was illegal.

"It was started illegally. Everything about it was crooked. Every single thing about it. There were dirty cops," he said.

He falsely claimed that the Mueller report had found "no obstruction." While the four-page letter released by Barr said the special counsel did not find a criminal conspiracy between Russia and Trump associates around the time of the 2016 election, it also said Mueller had presented evidence on both sides of the obstruction question and ultimately did not reach a conclusion on it.

Barr said he did not believe the evidence in the report was sufficient to prove the president had obstructed justice. Democrats said they were concerned that Barr's letter portrayed the investigation's findings in an overly favorable way for Trump.

Barr's statement Wednesday that he expected to release a redacted version of Mueller's nearly 400-page report next week marked a slight change from the estimate he gave Tuesday, when he said the release would be within a week.

Though he said the document will be redacted to withhold negative information about peripheral figures in the investigation, he said that would not apply to Trump, who is an officeholder and central to the probe.