Former NASA spaceflyer Jose Hernandez, who is running in California for a seat in the U.S. House of Representatives this year, can call himself an astronaut on the ballot, a judge ruled March 29.

Hernandez, a Democrat, flew on Space Shuttle Discovery’s STS-128 mission in 2009 but left NASA more than a year ago, in January 2011. California Republicans had argued that Hernandez should not be allowed to list his occupation as “astronaut/scientist/engineer” on the ballot.

But Sacramento County Superior Court Judge Lloyd Connelly disagreed, saying that Hernandez is an astronaut for “more than the time spent riding a rocket.”

Hernandez is vying to represent California’s 10th Congressional District, in the state’s agriculture-heavy Central Valley. Hernandez knows the Valley and its leading industry well, having grown up picking fruits and vegetables all over California as the son of migrant farm workers.

The former astronaut is running against Republican Jeff Denham, as well as independent Chad Condit. The seat was formerly held by Ellen Tauscher, who resigned in 2009 to become U.S. undersecretary of state for arms control and international security.

California Republicans were critical of Judge Connelly’s decision.

“Allowing a candidate out of nowhere to use the profession of ‘astronaut’ when he hasn’t served in that profession recently is akin to allowing someone to use a title of ‘sailor’ when they no longer own or operate a ship,” California GOP spokeswoman Jennifer Kerns said in a statement.

Hernandez, for his part, said he was happy to move on. In a Facebook post written before the verdict came down, he expressed surprise at having to fight this battle in the first place.

“I always thought the hardest part of being an astronaut would be the training,” Hernandez wrote. “I didn’t realize it was going to be proving it in court.”