A congressional committee led by Democrats voted to hold the US attorney general, William Barr, and the commerce secretary, Wilbur Ross, in contempt on Wednesday for their refusal to turn over materials relating to proposed controversial changes in how the country counts its citizens.

The 24-15 vote in the House oversight committee came after Donald Trump asserted executive privilege over documents shedding light on the Trump administration’s push to include a question about US citizenship on the 2020 census, in a move that was met with disbelief by former justice department officials.

“This is ridiculous,” tweeted Elie Honig, a former federal prosecutor from the southern district of New York. “Executive privilege is not some magic wand the President gets to wave to hide anything he wants, anytime he wants.”

The assertion of privilege on one side, and the contempt vote on the other, marked the latest in a series of clashes between Trump and Democrats in Congress trying to investigate matters from the former special counsel Robert Mueller’s findings to Trump’s tax returns.

In a separate skirmish on the same battlefield Wednesday, the former White House communications director Hope Hicks agreed to testify to Congress behind closed doors about material relating to Mueller’s investigation. It was unclear why the hearing, scheduled for next week, would not be made public.

But the current clash, over a Trump administration effort to add a question about US citizenship to the 2020 census, could have direct consequences for representative government and a growing divide between elected officials in Washington and the citizens they purport to represent.

The House committee, chaired by Elijah Cummings, has been trying to learn the motives behind a move by the Trump administration to add a question about US citizenship to the upcoming 2020 census.

Two weeks ago, it was revealed that a deceased Republican consultant had studied the citizenship question in Texas and concluded it would be “advantageous to Republicans and non-Hispanic whites”.

Facing the question could deter some nonwhite voters from participating in the census at all. The decennial census is conducted by volunteers going door-to-door and asking about family units, race, age and other information. The information is used, among other things, to allot each state its deserved number of congressional representatives, which are currently based on a state’s population.

As part of their broader strategy to distort the voter pool, Republicans want to tie the allotment of congressional districts to the number of US citizens of voting age in each state instead of overall population, in effect shrinking states with large immigrant populations.

“The census is critical to our democracy and our constituents,” Cummings said in a statement. “We must protect the integrity of the Census, and we must stand up for Congress’ authority under the Constitution to conduct meaningful oversight.”

The justice department attacked the contempt vote in a statement by a spokeswoman, Kerri Kupec.

“The committee’s attempt to define the Department of Justice’s good-faith cooperation as ‘contempt’ defies logic,” she said. “Today’s action by Chairman Cummings and his committee undermines Congress’s credibility with the American people.”

The Trump administration’s move to include the citizenship question on the census is the subject of a legal challenge currently before the US supreme court, which is expected to rule soon on whether such a question can be included in the survey.

The clash over the documents behind the census question echoes an episode from last month, when the House judiciary committee moved to hold Barr in contempt for the justice department’s refusal to turn over documents related to the Mueller report.

As the committee convened, the Trump administration asserted executive privilege over the entire report, much of which had already been published and which the president himself had discussed at length, if highly misleadingly, with his 60m Twitter followers.

The committee voted to hold Barr in contempt, but the two sides worked out a compromise before the matter could be finalized with a vote by the entire membership of the House.