Fourteen House Republicans voted against the bill. One of them, Matt Rosendale of Montana, said the legislation was all about “identity politics”.

“Since I believe in treating everyone equally, regardless of race, and that we should be focused on what unites us rather than our differences, I will vote no,” he said.

Clay Higgins, a Louisiana Republican, said he would support the measure, even though he objected to the bill’s proposal to name the new holiday Juneteenth National Independence Day.

“Why would the Democrats want to politicise this by co-opting the name of our sacred holiday of Independence Day?” Higgins asked, arguing they should have instead used the word “emancipation”.

An attempt to pass the same bill last year foundered when a Republican senator objected to the annual cost, which he pegged at $600m (£430m). But no-one opposed the measure in the upper chamber on Monday when it was passed unanimously.

In 1980, Texas became the first state to observe Juneteenth as an official holiday. It is also a paid holiday for state employees in New York, Virginia and Washington.

It marks the day that US Army General Gordon Grainger formally told enslaved African-Americans in Galveston, Texas, that the American Civil War had ended two months earlier and they had been freed by the Emancipation Proclamation, enacted two-and-a-half years earlier by President Abraham Lincoln.