A man accused of stalking his ex-girlfriend hid from police in a popular corn maze in a northern California pumpkin patch on Saturday, investigators said.

Ryan Watt, 29, was arrested at the Petaluma Pumpkin Patch, an hour north of San Francisco, around 11 a.m. on Saturday, according to a Petaluma Police news release.

Watt was accused of violating a restraining order by stalking his former girlfriend online, in person and by using a GPS tracking device secretly planted on her car.

OFF-DUTY CALIFORNIA OFFICER KILLED IN CRASH ON FREEWAY

Police said he'd been arrested multiple times earlier this month. Incidents included Watt allegedly showing up at his ex-girlfriend’s home uninvited, attending her son's school athletic practices uninvited, hacking her social media accounts and texting her to let her know he was monitoring her whereabouts, according to the news release.

SUSPECTED ARSONIST SET CALIFORNIA WILDFIRES BEFORE ATTENDING HIGH SCHOOL REUNION: REPORT

Petaluma Police said Friday night they received another report that Watt violated the restraining order, this time by calling and texting his ex-girlfriend, asking if she would drop the pending cases against him. They said officers then looked for Watt at several homeless camps, found him and tried to arrest him, but he managed to escape.

Police said officers conducted foot patrol at the same homeless camps the next morning around 9 a.m. and found Watt. He evaded arrest by running across a freeway and into the corn maze at the Petaluma Pumpkin Patch, according to the news release.

Petaluma Police officers, with the help of California Highway Patrol motor officers and the agency’s airplane, surrounded the corn maze and found Watt on the pumpkin patch property, police said, adding that they arrested him without incident.

CLICK HERE TO GET THE FOX NEWS APP

A charge of stalking against Watt was being reviewed by the Sonoma County District Attorney’s Office, police said.

He has been booked at Sonoma County Jail with a bail of $250,000.