Updated

A 53-year-old man pleaded guilty Friday to resisting police outside the set of a Miley Cyrus movie on the Georgia coast after prosecutors agreed to drop charges that he tried to stalk the teen pop star.

Mark McLeod, who told police he was engaged to marry the 16-year-old "Hannah Montana" star, was sentenced by a State Court judge to two years probation and was ordered to undergo a mental health evaluation. He was also banished from Savannah and surrounding Chatham County and ordered to stay away from Cyrus and her family.

District Attorney Larry Chisolm issued a statement saying prosecutors dropped attempted stalking charges against McLeod because they lacked evidence that his "attempt to reach or follow Miley Cyrus was different than the hundreds of other fans."

He also said authorities had to consider the safety of Cyrus and other citizens without overreacting because a celebrity was involved.

McLeod, of Appling, Georgia, had been jailed since Aug. 4. Police said he twice came to Tybee Island, 12 miles (19 kilometers) east of Savannah, looking for Cyrus over the summer as she filmed the Walt Disney Pictures movie "The Last Song."

More On This...

Prosecutors moved quickly to resolve the case after a grand jury declined to indict McLeod on felony charges Wednesday. He pleaded guilty to misdemeanors of obstruction of a police officer and disorderly conduct. A third charge of attempted stalking, also a misdemeanor, was dropped.

McLeod's attorney, James Byrne, said he was pleased the unemployed assistant plumber would finally get help for any mental problems.

"I guess he's just like an avid fan and obviously there's some delusion going on, but that's not against the law," Byrne said. "The evidence didn't show that he ever had any intention of harming (Cyrus) or her family."

Cyrus' publicist, Meghan Prophet, declined to comment on the case Friday.

Wearing shackles and an inmate jumpsuit, McLeod wasn't asked about Cyrus in court Friday. He appeared confused at times, particularly when the judge told him he couldn't use a computer during his probation.

A spokeswoman for District Attorney Larry Chisolm said she could not immediately comment on the decision to drop the attempted stalking charge.

McLeod was first arrested in June after police said he made inappropriate comments to young girls gathered in hopes of glimpsing Cyrus during filming. A police report said McLeod told officers he was there "to be with Miley" and tried to head butt one of them as they tried to remove him in handcuffs from the beach.

Officer Warren Millikan wrote in his report that McLeod claimed he'd sent Cyrus diamond rings and other gifts and that she had accepted his marriage proposal. He said she sent him "secret messages" through her TV show.

McLeod was initially released from jail but was arrested a second time after returning to Tybee Island in August. Police said security officers for Walt Disney Pictures spotted him knocking on doors of homes near the movie set and asking residents if they knew where he could find Cyrus.