Immigration activists rally outside the Supreme Court as the justices hear arguments over the Trump administration's plan to ask about citizenship on the 2020 census, in Washington, Tuesday, April 23, 2019.

WASHINGTON — The House Oversight and Reform Committee advanced a resolution Wednesday to hold Attorney General William Barr and Commerce Secretary Wilbur Ross in contempt of Congress for withholding documents on the Trump administration's decision to add a citizenship question to the 2020 census.

The vote, 24-15 largely along party lines, came only hours after President Donald Trump asserted executive privilege to block access to the information. The Department of Justice announced the move in a letter to the committee's chairman, Rep. Elijah Cummings, D-Md., just as the panel was preparing to vote on the resolution Wednesday morning. Only one Republican, Justin Amash of Michigan, voted in support of the measure.

Trump told reporters at the White House in the afternoon that "it's totally ridiculous" not to include the question in the census.

"Can you imagine you send out a census and you're not allowed to say whether or not a person is an American citizen?" the president said, speaking alongside the visiting president of Poland. "In Poland, they say they're either Polish or they're not."

"I think it's totally ridiculous that we would have a census without asking," Trump added. "But the Supreme Court is going to be ruling on it soon. I think when a census goes out, you should find out whether or not, and you have the right to ask whether or not, someone is a citizen of the United States."

The House resolution allows Democrats to pursue both civil and criminal contempt charges against Barr and Ross for defying subpoenas issued by Cummings on April 2 to produce the documents. Now, Democratic leadership and House counsel must decide which avenue to pursue.

More from NBC News:

Congress raises questions Mueller left unanswered about Trump, Russia

Ex-Trump aide Hope Hicks to appear before House Judiciary Committee

House approves enforcing subpoenas in court against Trump officials

To take action in criminal contempt, the House will need to hold a full floor vote. For civil contempt, Democrats can seek authorization from a bipartisan group of House leaders, in which Democrats hold the majority, to file a lawsuit to enforce the committee's subpoenas.

"What we have learned in this investigation is quite disturbing," Cummings said in his opening remarks at the committee meeting, stating that the committee obtained evidence that Ross was "aggressively pressing his staff" to add the citizenship question to the 2020 census months before the DOJ made the request to include it, and that Ross did so at the urging of the White House.

Cummings said the administration has claimed that it has supplied 17,000 pages of documents on the issue to the committee.

"This is true, but the vast majority of these documents were already public; others were heavily redacted," he said.

Rep. Jody Hice, R-Ga., a member of the committee, said lawmakers should not vote on a contempt resolution until the public gets a clear understanding of why Democratic lawmakers oppose adding the question.

"The American people need to know what's going on here," Hice said. "Democrats simply don't want to have a citizenship question, and it is important for us to ask why. We know that that question cannot be used for immigration enforcement. It cannot be used for deportation. These types of things are in federal law. So the question is, why do the Democrats not want to know how many citizens are in this country?

Those who oppose adding the question to the census say it would likely suppress the response rate in immigrant communities, leading to an undercount. The administration, meanwhile, has argued that including the question would help it to enforce the Voting Rights Act.

The committee had planned to vote on the resolution Wednesday morning, but postponed action until the afternoon to allow members to read the Justice Department letter stating why the president had asserted executive privilege.

The day before, the department warned Cummings in a letter that it would recommend the president assert executive privilege if the House voted to hold the officials in contempt of Congress.

Rep. Jim Jordan of Ohio, the top Republican on the committee, also sent a letter to Cummings on Tuesday charging that the chairman had rushed to hold the contempt vote and had violated committee rules in scheduling it. He argued that both Barr and Ross "have cooperated — and continue to cooperate — with your investigation."

The Oversight Committee vote comes a day after the House approved a resolution to authorize the House Judiciary Committee and other panels to go to court to enforce their subpoenas of the Trump administration.

That measure, which was adopted 229-191 along party lines, allows the Judiciary Committee to sue Barr and former White House counsel Don McGahn for refusing to comply with its subpoenas related to former special counsel Robert Mueller's report on Russia's efforts to influence the 2016 election and possible obstruction of justice by Trump.

The Judiciary Committee voted in May to advance a measure to hold Barr in criminal contempt of Congress, but Chairman Jerry Nadler, D-N.Y., said Monday that he would hold off on that threat after reaching an agreement with the Justice Department to obtain some underlying evidence from the Mueller report related to possible obstruction of justice by Trump.

Cummings said the House vote Tuesday marked "a pivotal moment for Congress in our ability to conduct oversight as an independent branch of government."

The White House, Cummings said, has "not turned over one single shred of paper in response to any of our requests" about such things as the response to Hurricane Maria in Puerto Rico; executive branch security clearance concerns; efforts to transfer nuclear technology to Saudi Arabia; and hush payments that the president's former longtime lawyer, Michael Cohen, made to women who allege past affairs with Trump, which he has denied.