Republican who aligned himself closely with President Donald Trump beats Democratic rival Dan McCready in do-over vote.

Republican Senator Dan Bishop has narrowly won a special United States congressional election in North Carolina, saving a longtime stronghold for the party of President Donald Trump.

With 99 percent of precincts reporting, Bishop secured 50.81 percent of the votes in the 9th Congressional District, a suburban-rural area in the southeastern part of North Carolina.

His rival, Dan McCready, won 48.59 percent of the votes, the state board of elections said on Tuesday.

North Carolina’s 9th congressional district has been represented by Republicans in Congress since the 1960s and voted for Trump by about 12 percentage points in 2016.

Tuesday’s close election highlighted the challenges both parties might face in next year’s presidential race.

It also brought to an end a political drama that started in 2018 when McCready lost against Republican Mark Harris. At the time, officials ruled the election was tainted by evidence of fraud and ordered a new vote, which Harris decided not to contest.

Both parties poured millions of dollars into the election do-over, with the final contest of the 2018 congressional midterms being watched for signs of their prospects next year.

Bishop, a 55-year-old state senator best known for a North Carolina law dictating which public bathrooms transgender people can use, campaigned on taxes, the economy and immigration. He echoed Trump’s political themes, asserting McCready “admires socialism” and linking him to the “Squad”, a group of Democratic congresswomen of colour who Trump has repeatedly attacked.

For his part, McCready, a 36-year-old Marines veteran and small business owner, sought to steer the campaign discussion away from Trump and onto issues such as healthcare, education and teacher pay.

After the announcement of the results, Trump, who flew to the district on Monday night to rally the Republican base for Bishop, wasted no time and immediately took credit.

Dan Bishop was down 17 points 3 weeks ago. He then asked me for help, we changed his strategy together, and he ran a great race. Big Rally last night. Now it looks like he is going to win. @CNN & @MSNBC are moving their big studio equipment and talent out. Stay tuned! — Donald J. Trump (@realDonaldTrump) September 11, 2019

In a victory speech, Bishop thanked Trump and promised to support the president’s agenda in Washington. He said the result should send a message nationwide that voters were rejecting the “radical, liberal policies being pushed by today’s Democratic Party”.

“Tonight was the first step toward taking back the House of Representatives in 2020 to keep this country on a path of prosperity and strength,” the Republican told a cheering crowd.

McCready appeared before supporters next to his wife Laura and offered his support to Bishop, repeating his campaign slogan, “country before party”.

“We may not have won this campaign, but that does not mean that we were wrong,” McCready said in his concession speech on Tuesday night. “And as long as there are people who thrive off our division, there is still work to be done.”

Dan McCready, the Democratic candidate in the special election for North Carolina’s 9th Congressional District gives his concession speech after losing the race [Jonathan Drake/Reuters]

Eyes on the 2020 elections

Republicans hope the victory will help the party launch a comeback effort to wrest the House away from Democrats after losing 40 seats and overall control in House elections in November last year.

Democrats had been hoping to show that 2018 was not their high-water mark and looked to further weaken support for Trump and his Republicans in suburban areas.

The chairwoman of the Democratic congressional campaign arm, Representative Cheri Bustos, said Democrats had fallen “an inch” short but that Republicans had required millions in spending and a Trump rally just to “scrape by.”

“Tonight’s razor-thin result in this ruby-red district solidifies the fact that Democrats are pushing further into Republican strongholds and are in a commanding position to protect and expand our House majority in 2020,” she said on Tuesday.

Republicans on Tuesday also won a special election in another district in North Carolina where they had been expected to do so.

Republican Greg Murphy defeated Democrat Allen Thomas for a seat left vacant by longtime Republican Representative Walter Jones’ death in February.