US President Donald Trump and Treasury Secretary Steven Mnuchin (L) speaks during a tour of the H&K Equipment Company in Coraopolis, Pennsylvania on January 18, 2018.

"In refusing to comply with the statute, Defendants have mounted an extraordinary attack on the authority of Congress to obtain information needed to conduct oversight of Treasury, the IRS, and the tax laws on behalf of the American people who participate in the Nation's voluntary tax system," the complaint says.

That section of the federal tax code clearly states that the Treasury "shall furnish" an individual's returns if a formal written request is made, Democrats argue.

The legal complaint in U.S. District Court in Washington, D.C., says that Mnuchin, Rettig and their departments "have now — for what the Committee believes is the first time ever — denied a Section 6103(f) request in order to shield President Trump's tax return information from Congressional scrutiny."

The legal action shows the Democrat-led panel following through on its threat from months earlier, when Treasury Secretary Steven Mnuchin and IRS chief Charles Rettig defied subpoenas to hand over six years of Trump's personal and business returns. Mnuchin had argued that the committee had no "legitimate legislative purpose" to request the president's federal tax returns.

The House Ways and Means Committee on Tuesday sued the Treasury Department and the IRS to get President Donald Trump's tax returns, a spokesman for a committee member told CNBC.

Democrats say they do not need to justify their request under that statute. But they nevertheless argue that the returns are a necessary component in their probe of the IRS' "administration of various tax laws and policies relating to Presidential tax returns and tax law compliance by President Trump" — including the efficacy of the agency's "self-imposed policy of annually auditing the returns of sitting Presidents."

"Indeed, President Trump himself has repeatedly questioned the integrity of the process by which the IRS audits his tax returns," the legal document adds, "complaining that his returns are under 'continuous audit' and that the IRS's policy of annually auditing Presidential returns is 'extremely unfair.'"

The lawsuit was first reported by The Wall Street Journal.

"Despite its mandatory obligation, the Treasury Department failed to comply with the law and denied the Committee's request," Ways and Means Chairman Richard Neal said in a press release.

Ranking Republican Kevin Brady of Texas responded: "The Democrats' partisan, flawed lawsuit continues their unprecedented and illegitimate pursuit to expose President Trump's private tax information. This not only weaponizes the tax code and puts every taxpayer at risk, this lawsuit goes further and — for the first time — circumvents America's democratic process by replacing the U.S. House's voice with [Democratic House Speaker] Nancy Pelosi's voice.

Brady added that the majority's tack is "a dangerous course of action. For this reason, I am introducing a resolution to preserve the integrity of the People's House from the attacks of the elite few and restore the voice of every American."

It was not immediately clear what Brady's resolution would entail.

The Treasury Department did not immediately respond to CNBC's request for comment on the lawsuit. Trump attorney Jay Sekulow told NBC News, "We will respond to this latest effort at Presidential harassment in Court."

"The judiciary has been a bulwark against Trump's steaming corruption and roughshod lawlessness. The law is as clear as fine crystal," said Ways and Means committee member Bill Pascrell, D-N.J., in a statement. "We have been pursuing transparency of this man for a long time, and we won't stop until we provide it for our country."

Both sides had signaled that the federal courts would be the proper next step in the dispute. "This is why there are three branches of government," Mnuchin said in May.

The Trump administration has looked to the courts to block other efforts from House Democrats to obtain information about the president and his associates.

Trump had sued to block a subpoena for financial documents from accounting firm Mazars lodged by the House Oversight and Government Reform Committee and had also filed suit to block subpoenas for financial documents from Deutsche Bank and Capitol One issued by the House Intelligence and Financial Services committees.

Federal judges in both of those cases ruled against Trump, who later appealed both decisions.

Read the full complaint below: