Updated

Republican Rep. Blake Farenthold of Texas, who isn't seeking re-election amid allegations of sexual harassment, won't appear on 2018 primary ballots after Democrats unsuccessfully tried Wednesday to leave his name in place.

Democrats argued that Farenthold's name should have to remain on the ballot since he missed the deadline in Texas for candidates to withdraw. But they quickly dropped a lawsuit Wednesday after losing before a federal judge.

Farenthold announced last week he would retire while denying 3-year-old accusations that he'd subjected a former aide to sexually suggestive comments. Fellow Republicans urged him not to run again, and Farenthold apologized for an office atmosphere that he said included "destructive gossip, offhand comments" and other behavior.

Farenthold's decision came four days past the Texas deadline for candidates to withdraw, prompting the Texas GOP to file its own lawsuit last week to remove his name. The party claimed victory Wednesday, saying state elections officials had signaled they couldn't force Farenthold's name to remain on the ballot.

In 2006, Democrats sued to keep former U.S. House Majority Tom DeLay on the ballot when the powerful Republican resigned after being indicted. Republicans weren't allowed to replace DeLay, who had already won his primary, and instead had to back a write-in GOP candidate who went on to lose to Democrat Nick Lampson.

Six Republicans and four Democrats are vying to replace Farenthold.