COLUMBIA, S.C. — A judge on Wednesday upheld the South Carolina Republican Party's decision not to hold a 2020 presidential primary, a move taken by several states in erecting hurdles for the long-shot candidates challenging President Donald Trump.

In her order, Circuit Judge Jocelyn Newman wrote the law “does not give Plaintiffs a legal right to a presidential preference primary, and the Court will not substitute its own judgment for that of the General Assembly or the SCGOP."

Earlier this year, former South Carolina congressman Bob Inglis sued state Republicans, saying the party’s decision to skip a primary deprives him and others “of the ability to vote for the candidate of their choice in South Carolina’s famous (and particularly influential) ‘First in the South’ primary.”

South Carolina is among several states that have canceled Republican primaries and caucuses next year, an effort that helps Trump consolidate his support as Democrats work to winnow their large candidate field. The move, taken September in South Carolina by the state party’s executive committee, is not unusual for the party of the White House incumbent seeking reelection.

Challengers have emerged to Trump, including former Massachusetts Gov. Bill Weld and former Illinois congressman Joe Walsh. Mark Sanford, a former congressman and governor from South Carolina, entered the race but left after two months.

In years past, both Republicans and Democrats have cut state nominating contests when an incumbent president from their party sought a second term. In 1984, South Carolina GOP leaders opted to call off their primary as President Ronald Reagan sought reelection. In 2004, the GOP again canceled the state’s primary, with leaders deciding instead to endorse President George W. Bush’s reelection.

The South Carolina Democratic Party didn’t hold presidential primaries in 1996 or in 2012, when Presidents Bill Clinton and Barack Obama were their incumbents.