First he lost his shorts. Then he lost his suit.

A Cape May County man who was arrested after twice swimming naked in Wildwood Bay in front of patrons of the Wharf restaurant two years ago lost a federal lawsuit this week claiming mistreatment and excessive force, first by Wildwood police and later at the Cape May County jail.

William Shoffler, then 65, says he was merely swimming in the bay in front of property he owns in Wildwood adjacent to the Wharf in June 2017 when his corduroy shorts slipped off not once, but twice. The manager of the restaurant called police after patrons noticed the naked swimmer.

Police cornered him, still naked, inside a shed on his property on West Burk Avenue.

That confrontation, during which Shoffler allegedly cursed at the officers and at “South Jersey cops” in general, led to his being charged with disorderly conduct not once but twice, as a short time after the first incident, he returned to the bay and again swam naked, again prompting a complaint by the restaurant and its patrons.

A Wildwood police officer, James Stevens, returned, and the confrontation turned physical, with Shoffler recalling being pushed face down in the sand and being handcuffed behind his back.

Shoffler, of Middle Township, contended in the lawsuit that two officers, Stevens and Officer Christopher Chobert, used excessive force in arresting him and that he was mistreated, including being denied use of the bathroom while handcuffed to a bar at the Wildwood police headquarters. Bail was set at $3,500 and he was sent to the county jail.

While at the county jail, Shoffler further contended, he was pepper sprayed and had a hood placed over his head for several hours, which the lawsuit described as “torture” that inflicted emotional and physical distress on him. He said Wildwood officers and members of the Sheriff’s Department were negligent and improperly trained. All charges against Shoffler were eventually dismissed.

In a 42-page opinion released Tuesday, U.S. District Judge Noel L. Hillman granted a motion to dismiss the case filed by the defendants. He said most of the facts were not in dispute.

Shoffler was videotaped and photographed leaving the bay naked, the judge noted, and Wildwood police also observed him “with their own eyes.” Public nudity is prohibited in Wildwood.

The judge found no constitutional issues with Shoffler’s treatment by Wildwood police, in whose custody he was for about two hours (even if he was denied the use a bathroom for that length of time, which Wildwood did, the judge noted).

The judge ruled that the facts surrounding the excessive force claim were not in dispute: Shoffler was taken to the ground by the police officer, Lysol was sprayed around or near him while at the Wildwood police headquarters, he was handcuffed to a bar at headquarters, and forced to “twist uncomfortably” during a ride in a police vehicle.

None of those actions constitutes a “violation of excessive force,” the judge wrote.

The judge also ruled the police did not conduct an unlawful search when they entered Shoffler’s property after receiving the complaint about the naked swimmer and looked inside the shed. The shed constitutes an “open field” under the law and not a residence, the judge ruled. The shed is part of a kayak rental business, he noted.

“The property is visible to the public,” the judge wrote. “In fact, the officers observed plaintiff naked in his shed upon their arrival to the property before entering the property.”

Shoffler’s lawyer, Richard F. Klineburger III, was not immediately available for comment Wednesday.