WASHINGTON — A Republican running to represent one of the nation’s most rapidly diversifying congressional districts once said the Supreme Court was wrong when it ruled in a landmark civil rights case to legalize interracial marriage — a comment he says was a slip-up.

Greg Hill, a Brazoria County court-at-law judge, this week declared his candidacy in what is widely expected to be one of the hardest fought congressional races in the state. The former Pearland City Council member said during a council meeting in 2013 that “the Supreme Court has been wrong a number of times. They were wrong when they decided Loving versus Virginia.” The 1967 ruling affirmed interracial marriage in the U.S.

Hill told the Chronicle that he misspoke at the time and cited the wrong decision — he says he was actually referring to the Virginia state supreme court’s ruling in Loving v. Virginia, which upheld the state’s ban on interracial marriage. That was the decision the high court later overturned.

Hill, who is stepping down as a Brazoria County court-of-law judge to run for Congress, is the first Republican to join the race to replace U.S. Rep. Pete Olson in a Fort Bend district that Democrats have targeted to flip in 2020.

Related: Democrats pounce as Houston-area rep. Pete Olson announces retirement

The comment in question has been used by Hill’s political foes before — one of whom posted it on YouTube —and is likely to surface again as the 2020 race heats up.

Hill called it “a smear job.”

“It didn’t work then and it won’t work now because the voters of Brazoria know me and they know my heart,” he said.

Hill made the comment during a heated city council debate about gun control. Amid the national response to the December 2012 mass shooting at a school in Sandy Hook, Conn., the council passed a resolution to be sent to federal lawmakers saying any attempt to limit gun ownership would be “misguided and unconstitutional” and would be “viewed as an infringement on the constitutional rights of the citizens of Pearland.”

“The purpose of the resolution is to simply say this is where we stand as a city because this has become such an issue at the federal level,” Hill said at the meeting before saying “the Supreme Court has been wrong a number of times. They were wrong when they decided Loving versus Virginia.”

Texas Take: Get political headlines from across the state sent directly to your inbox

Asked if he believes the U.S. Supreme Court got it right in Loving v. Virginia, Hill replied: “No question about it … That’s the point I thought I was making. And apparently, I wasn’t clear.”

Scott Sherman, a Democrat with whom Hill was arguing at the meeting, said he remembers afterward that Hill “indicated to me that he misspoke but I do not recall his exact explanation.”

“I do not believe Greg is, has been or ever will be against interracial marriage but I do believe he is wrong on the issue of guns and the second amendment,” Sherman said.

Hill is running in a district that has grown more than any in Texas - and is rapidly diversifying, as well. More than 167,000 residents identify as Asian, nearly 20 percent of the population — far beyond any other district in Texas. About 25 percent of the district’s residents are Hispanic, and 14 percent are black.

For subscribers: Diversity, Democratic enthusiasm led to ‘blue wave’ in Fort Bend County

It’s widely expected to be one of the most closely contested races in the state after Olson, who announced last month he will retire, narrowly won re-election in 2018. Democratic challenger Sri Preston Kulkarni, one of three Democrats running for the seat now, came within 5 percentage points of defeating Olson.

Hill was the first Republican to jump in the race, but isn’t expected to be the only one. There has been widespread speculation that Fort Bend County Sheriff Troy Nehls would run for the seat, as well.

ben.wermund@chron.com