The appeal of a registered sex offender, who was arrested under a county ordinance when he visited a park in Fountain Valley, went to court Thursday.

Hugo Godinez of Santa Ana, who was convicted Nov. 14 of a misdemeanor for entering a county park without written permission from the Orange County Sheriff's Department, is the first registered offender to appeal the county statute, said Farrah Emami, a spokeswoman for the district attorney's office.

Attorneys for both sides gave oral arguments Thursday morning at the Central Justice Center in Santa Ana. Godinez, who is represented by two public defenders, argued in court documents that the county ordinance is "unconstitutional on its face" and that state law preempts county law regarding treatment of sex offenders.

He and his attorneys also said the statute shouldn't apply to all sex offenders, since some are more dangerous than others, and that the rule about offenders staying away from places where "children regularly gather" is too vague.

According to a release from the district attorney, Godinez is a registered offender with the Costa Mesa Police Department. He was required to register as a sex offender for life after being convicted of one misdemeanor count of sexual battery on June 23, 2010.

The following year on May 5, Godinez entered Mile Square Regional Park in Fountain Valley during a Cinco de Mayo celebration and stayed for several hours. In court documents, he said the event was a company picnic for his employer, a landscape maintenance company.

A month later, Godinez admitted to the sheriff's department that he had gone to the park without permission and that he was going to admit the violation to his deputy probation officer, according to the district attorney's release. He was incarcerated for violating probation and released nearly two months later, but failed to re-register as a sex offender within five days of being released.

In September 2011, Godinez admitted to his probation officer that he had neglected to re-register and was taken into custody by the county again.

In addition to his misdemeanor count for entering the park, Godinez was convicted of one misdemeanor count of failing to register and show proof of residency upon release from incarceration, according to the release. He was sentenced to 100 days in the Orange County Jail and five years of formal probation.

The statute, which the Orange County Board of Supervisors adopted in April 2011, bars registered offenders from entering parks and other county-owned recreation areas where children regularly gather unless they have official written permission.

Since the county's law passed, several cities, including Huntington Beach, have instituted similar laws to keep sex offenders out of city-owned areas.

michael.miller@latimes.com

Twitter: @MichaelMillerHB