By JEFFREY COLLINS

COLUMBIA, S.C. (AP) — A man serving 18 years in prison in South Carolina for burglary was rightfully convicted in part because he left his cellphone at the crime scene and a detective guessed his passcode as 1-2-3-4 instead of getting a warrant, the state Supreme Court ruled Wednesday.

Lawyers for Lamar Brown argued detectives in Charleston violated Brown’s right to privacy by searching his phone without a warrant.

After storing the cellphone in an evidence locker for six days in December 2011, the detective guessed right on Brown’s easy passcode, found a contact named “grandma” and was able to work his way back to Brown.

The justices ruled in a 4-1 decision that Brown abandoned his phone at the Charleston home and made no effort to find it. The law allows police to look at abandoned property without a court-issued warrant allowing a search.

“Any police officer would assume after six days of no efforts by the owner to recover this phone — especially under the circumstance that the owner left the phone at the scene of a burglary — that the owner had decided it was too risky to try to recover it. Brown’s decision not to attempt to recover the phone equates to the abandonment of the phone,” associate justice John Few wrote in the majority opinion.

But in his dissent, South Carolina Chief Justice Don Beatty said Brown likely didn’t consider his cellphone abandoned and his passcode showed he wanted to protect the contents inside and police should have gotten a warrant for a search like they would the home or car of someone suspected in a crime.

It “is not that the information on a cellphone is immune from search; it is instead that a warrant is generally required before such a search,” Beatty wrote, quoting U.S. Chief Justice John Roberts from an earlier case.

The condominium owner found Brown’s cellphone when it rang in his bedroom as he and his girlfriend opened Christmas presents. He discovered the bedroom window was broken and his television, laptop computer, two of his roommate’s laptops, and jewelry was taken, according to court records.