The Republican Party of Texas sued the secretary of state Friday to keep U.S. Rep. Blake Farenthold off the 2018 ballot after the congressman accused of sexual harassment said he will not seek reelection.

Farenthold, R-Corpus Christi, announced his intent to retire two days after the state's Tuesday deadline to withdraw from the general election primary, creating a potential headache for GOP leaders.

READ MORE: Blake Farenthold, facing new sexual harassment probe, announces he won't seek re-election

"By disallowing Mr. Farenthold's withdrawal from the primary election, the state is forcing the Republican Party of Texas to be associated with Mr. Farenthold via his appearance on the primary ballot. Neither Rep. Farenthold nor the Republican Party of Texas desires this outcome," Chris Gober, an attorney for the Texas GOP, said in a federal lawsuit requesting the state be barred from enforcing its withdrawal deadline.

Now Playing:

U.S. Rep. Blake Farenthold, facing multiple allegations of sexual harassment and inappropriate behavior towards at least three former staffers, said Thursday he will not seek reelection.

Media: Elect Blake Farenthold Facebook Page

Sam Taylor, a spokesman for the secretary of state's office, declined to comment on pending litigation.

Six other Republicans and four Democrats have filed to challenge Farenthold in the 27th Congressional District.