WASHINGTON — The Justice Department will tighten its rules around obtaining records from members of Congress, Attorney General Merrick Garland said Monday, amid revelations the department under former President Donald Trump had secretly seized records from Democrats and members of the media.

“Consistent with our commitment to the rule of law,” Garland said in a statement, “we must ensure that full weight is accorded to separation-of-powers concerns moving forward.”

The Justice Department is struggling to contain the fallout over revelations that it had confiscated phone data from House Democrats and reporters as part of an aggressive investigation into leaks. The disclosure is also forcing Biden administration officials to wade back into a fight with their predecessors — something they’ve wished to avoid.

Garland’s statement came as a Justice Department official said the top national security official, John Demers, was resigning and plans to leave by the end of next week. Demers, who was sworn in a few weeks after the subpoena for the Democrats’ records, is one of the few Trump appointees who has remained in the Biden administration.

He had planned for weeks to leave the department by the end of June, a second person familiar with the matter said. The two could not discuss the matter publicly and spoke to Associated Press on the condition of anonymity.

News outlets reported last week that the Justice Department had secretly subpoenaed Cupertino, California-based Apple Inc. in 2018 for metadata from two Democratic members of the House Intelligence Committee — California Rep. Adam Schiff and California Rep. Eric Swalwell — as their committee was investigating Trump’s ties to Russia. Schiff, at the time, was the top Democrat on the panel.

Now the House Intelligence Committee Chair, Schiff said Monday that he had spoken with Garland, who had given his commitment to an independent investigation by the inspector general. Schiff said he had “every confidence” that Garland “will also do the kind of top-to-bottom review of the degree to which the department was politicized during the previous administration and take corrective steps.”

The intelligence panel initially said 12 people connected to the committee — including aides, former aides and family members — had been swept up, but more have since been uncovered, according to a person familiar with the matter who also was not authorized to discuss it publicly and spoke to the AP on condition of anonymity.

Some people might not know they were targeted because the Apple notification was by email and showed up in the spam filters of some of those who were contacted, the person said.

The subpoena, issued Feb. 6, 2018, requested information on 73 phone numbers and 36 email addresses, Apple said. It also included a nondisclosure order that prohibited the company from notifying any of the people, and it was renewed three times, the company said in a statement.

Apple said that it couldn’t challenge the warrants because it had so little information available and that “it would have been virtually impossible for Apple to understand the intent of the desired information without digging through users’ accounts.”

Senate Judiciary Committee Chair, Sen. Dick Durbin, D-Ill., asked Garland to provide details about the department’s decision and legal basis for the subpoena and demanded the Justice Department provide the committee with a copy of the subpoena and other records about the decision to obtain the order.

The department’s inspector general has launched a probe into the matter after a request from Deputy Attorney General Lisa Monaco. Inspector General Michael Horowitz said he would examine whether the data subpoenaed by the Justice Department and turned over by Apple followed department policy and “whether any such uses, or the investigations, were based upon improper considerations.”

Meanwhile, a former government contractor who was given the longest federal prison sentence imposed for leaks to the news media has been released from prison to home confinement, a person familiar with the matter said Monday.

Reality Winner, 29, remains in the custody of the federal Bureau of Prisons, the person said.

She pleaded guilty in 2018 to a single count of transmitting national security information. Winner was sentenced to five years and three months in prison, which prosecutors said at the time was the longest ever imposed for leaking government information to the news media.

The former Air Force translator worked as a contractor at a National Security Agency office in Augusta, Georgia, when she printed a classified report and left the building with it tucked into her pantyhose. Winner told the FBI she mailed the document to an online news outlet.