The I.R.S. said on Thursday that its commissioner, Charles P. Rettig, had asked the inspector general who oversees tax matters to investigate how James B. Comey, the former F.B.I. director, and his deputy, Andrew G. McCabe — both perceived enemies of former President Donald J. Trump — came to be faced with rare, exhaustive audits that the agency says are supposed to be random.
“The I.R.S. has referred the matter to the Treasury Inspector General for Tax Administration for review,” the agency said in a written statement, adding that Mr. Rettig had “personally reached out” to the inspector general’s office after learning about the audits.
The disclosure from the I.R.S. came a day after The New York Times reported that Mr. Comey and Mr. McCabe had been the subjects of audits that target just several thousand Americans a year and are highly invasive.
In response to the story, Democrats also called for an inspector general’s investigation. They raised questions about whether Mr. Trump — who has a long history of trying to use the federal government for his political means — had played a role in ordering the audits. Both audits were conducted during a time when Mr. Rettig, who was appointed by Mr. Trump in 2018 to a term that is scheduled to expire in November, was running the agency.
“Donald Trump has no respect for the rule of law,” said the chairman of the Senate Finance Committee, Senator Ron Wyden, Democrat of Oregon, “so if he tried to subject his political enemies to additional I.R.S. scrutiny, that would surprise no one. We need to understand what happened here because it raises serious concerns.”
A spokesman for the Treasury Inspector General for Tax Administration did not return an email seeking comment about whether the inspector general had begun an investigation.
Under federal law, it is illegal for any official or employee in the executive branch — with a few narrow exceptions — to ask for the I.R.S. to audit or conduct an investigation of someone’s taxes. If an I.R.S. employee learns of such a request, the employee is required to report it to the inspector general. Defendants found to have violated the law can face up to five years in prison.
At the White House, the press secretary, Karine Jean-Pierre, sidestepped questions about whether President Biden, who had decided to keep Mr. Rettig in place as I.R.S. commissioner when he took office, had confidence in him to run the agency fairly.
“I’m going to say that he is up in November,” Ms. Jean-Pierre said.
In 2017, the tax year Mr. Comey was audited for, the I.R.S. says it randomly selected about 5,000 returns for the audit out of the 153 million people who filed them. For 2019, the year Mr. McCabe was audited for, the agency says its picked about 8,000 returns of the roughly 154 million that were filed.
It is not clear how two close associates both came to be scrutinized under the same audit program in a matter of a few years. Mr. Comey and Mr. McCabe both told The Times that they had questions about how the audits had come about.
Mr. Trump said he had no knowledge of the audits. The I.R.S. has denied that any wrongdoing occurred.
“Federal privacy laws preclude us from discussing specific taxpayer situations,” the I.R.S. said in a statement released Thursday. “Audits are handled by career civil servants, and the I.R.S. has strong safeguards in place to protect the exam process — and against politically motivated audits. It’s ludicrous and untrue to suggest that senior I.R.S. officials somehow targeted specific individuals for National Research Program audits.”
Former I.R.S. officials and tax lawyers said that because Mr. Comey and Mr. McCabe were attacked so frequently by Mr. Trump — who pushed for their prosecutions and accused them of treason — an inspector general or congressional committee should investigate the matter.
The chairman of the House Ways and Means Committee, Representative Richard E. Neal, Democrat of Massachusetts, sent a letter to the inspector general, J. Russell George, asking for an investigation.
“The American people need to have full faith in the I.R.S. and the fair administration of our tax laws,” Mr. Neal said. “I am very concerned about the impact on public confidence resulting from allegations that the I.R.S. has been used to exact revenge on political enemies.”
Mr. Neal asked the inspector general to investigate whether the audits were truly random, whether Mr. Trump’s political appointees or staff members played a role in the selection process and who at the I.R.S. or the Treasury Department can add or remove taxpayers from the list of those selected for the audit.
The ranking member on the House Ways and Means Committee, Kevin Brady, Republican of Texas, said that he supported investigating all allegations of political targeting at the I.R.S. and then sought to link the issue to criticism Republicans had directed at the tax agency under Democratic administrations.
“As we learned from the repeated targeting of conservative groups and the dangerous leaking of private tax returns under the Obama and Biden administrations, the I.R.S. should never be used as a weapon against political opponents,” Mr. Brady said.
A longtime critic of Mr. Rettig, Representative Bill Pascrell Jr., Democrat of New Jersey, who has previously called on Mr. Rettig to resign over unrelated issues, reiterated that demand on Thursday.
“The I.R.S. under Donald Trump’s handpicked commissioner Charles Rettig has been one catastrophe after another,” said Mr. Pascrell, who is the chairman of the Ways and Means Subcommittee on Oversight. “The auditing of two law enforcement leaders at Trump’s behest is a titanic scandal.”
Mr. Pascrell added: “If Mr. Rettig cared at all about this agency, he would hand in his resignation today. And if he doesn’t go, Mr. Rettig should be impeached.”
Chris Cameron and Michael D. Shear contributed reporting.