Cops can force you to unlock your smartphone with your fingerprint — but they can't force you to unlock it with your passcode, according to a judge in Virginia.

The decision, one of the first ones to deal with fingerprints and cellphones, confirms the fact that law enforcement agents can get access to a locked phone with legal means if they need to. At the same time a PIN or a password might enjoy more protection than a fingerprint.

Virginia Beach Circuit Court Judge Steven Frucci ruled that a criminal defendant can be compelled to give up his fingerprint and unlock his cellphone in the course of a criminal investigation — because that's just like handing in a DNA sample or a physical key, which citizens can already be legally compelled to give to police.

On the other hand, police can't force a defendant to give up his passcode, because that's considered "knowledge" — not a physical object — and knowledge is protected by the Fifth Amendment. There have been cases, however, where defendants have been asked to give up their password to decrypt their computers, so there no consensus on this issue yet, as Wired's Andy Greenberg reported recently.

The ruling sprung from an investigation involving David Baust, an Emergency Medical Services captain who was charged in February with attempting to strangle his girlfriend.

Baust's attorney has tried to stop prosecutors from getting access to his client's phone, where he could be storing a video of the incident, according to The Virginian-Pilot.

Technology and legal experts were not surprised by the ruling, since the Fifth Amendment, which protects against self-incrimination, doesn't protect physical objects like fingerprints.

"It's exactly what we thought it would happen when Apple announced its fingerprint ID," Hanni Fakhoury, a staff attorney at the Electronic Frontier Foundation, a digital rights organization, told Mashable. (Android phones such as the Galaxy S5 and HTC One Max also have fingerprint ID systems.)

While the ruling in Virginia Beach is not as binding as a Supreme Court decision, it does establish legal precedent other local courts can draw on. More importantly, "it's just a good wake-up call for people to realize that fingerprint ID doesn't necessarily provide the same sort of legal protection than a password does," Fakhoury says.

Last year, when Apple announced TouchID, its technology to unlock the phone with a fingerprint, some experts warned of this risk.

Fakhoury himself warned that fingerprints are not legally protected in an article for a legal news journal, while Marcia Hoffman, an Internet and privacy lawyer, said the same in a piece for Wired.

Called it! http://t.co/3KeNxF3T2M MT @robertcaruso judge: police can compel you to use TouchID to unlock your iPhone http://t.co/K3HBzrpgP4 — Marcia Hofmann (@marciahofmann) October 30, 2014

"We can’t invoke the privilege against self-incrimination to prevent the government from collecting biometrics like fingerprints, DNA samples, or voice exemplars," Hoffman wrote at the time. "Why? Because the courts have decided that this evidence doesn’t reveal anything you know."

The Supreme Court has never ruled on this issue specifically, but in a case involving a defendant right not to give up a his blood sample in 1966, the court ruled that "the Fifth Amendment offers no protection against compulsion to submit to fingerprinting."

This ruling comes on the heels of a controversy surrounding Apple and Google's new encryption protections for the iPhone and Android phones. High-ranking law enforcement officials, including FBI Director James Comey and U.S. Attorney General Eric Holder, have publicly complained that these measures will hinder police investigations.

But as Mashable, and others, have reported, there are still many ways for them to get data out of a cellphone. Getting your fingerprint is only one of them.

Here's how the parody account InfoSec Taylor Swift, which combines corny Taylor Swift pictures with serious cybersecurity commentary, weighed in.

“@robertcaruso: law enforcement can compel you to use TouchID to unlock your iPhone http://t.co/zlGENFygNL” << pic.twitter.com/B3VKETqo3B — InfoSec Taylor Swift (@SwiftOnSecurity) October 30, 2014

UPDATE, Nov. 5, 11:46 a.m. ET: Here's the full decision, obtained by UC Davis Law School professor Elizabeth Joh.

Fingerprint Unlocking Ruling

This story has been updated to add a link to a Wired story on forced decryption