Alan Martin, a clerk at the Hagerstown branch of the U.S. Postal Service, withdrew Monday from the race for Washington County Register of Wills.
Martin was forced to withdraw after learning that he is violating the Hatch Act, he said.
The Hatch Act prohibits federal employees and some state and local government employees from being candidates in partisan elections.
The Register of Wills is a partisan race. Martin is a Republican. He would have been running against incumbent John R. Bloyer, a Democrat.