A Virginia judge has openly defied his state's Supreme Court, ignoring a key immigration ruling in order to reopen the case of an immigrant slated for deportation. 

In a move that stunned attorneys involved in the case, Loudoun County District Court Judge Dean Worcester declared last week that he would not heed a January opinion by the Virginia Supreme Court. That ruling said judges could not use a certain legal provision to revisit convictions for immigrants who claim their attorneys did not tell them they could be deported. 

Worcester, who already has reopened several immigrants' cases, did not agree. But rather than take it on the chin and follow precedent, the judge granted himself an exception. 

"If this court were to abide by (the Virginia Supreme Court ruling), a constitutional violation will stand uncorrected," the judge wrote. "The court will not allow this to happen." 

Neither the defense nor the prosecution saw that coming. Rob Robertson, the immigrant's attorney in the case, told FoxNews.com that, although he was delighted with the ruling, he was "shocked" by it. 

"I think I'm more shocked than most other people that Judge Worcester ruled the way he did," Robertson said. 

The prosecutor in the case has filed an appeal. 

In the judge's opinion, Worcester acknowledged that his court is bound to follow precedent, particularly when the precedent comes from a higher court. However, he said, that standard "is not absolute and there are rare exceptions." 

Consider this one of them. 

The case in question involved an immigrant who pleaded guilty to a misdemeanor larceny charge in 2005. He was originally charged with a felony count but as a result of the plea agreement received a suspended sentence of 12 months in jail -- meaning he did not serve time. However, according to the court he was never told by his attorney that his conviction could have ramifications for his immigration status. Sure enough, the federal government in September 2010 ordered him deported to Peru. 

Because he was not in custody, the defendant could not challenge his treatment on a habeas corpus claim. Under Virginia law, the window also had long since passed to file a motion to reopen the case. So the defendant, Edgar Cabrera, pursued an avenue which had been used by other immigrants facing deportation -- citing a "writ of error" claiming he received ineffective counsel in violation of the Sixth Amendment. 

Backing up this defense was a U.S. Supreme Court ruling a year ago, Padilla v. Kentucky, which held that an attorney "must inform a client whether his plea carries a risk of deportation." 

But the Virginia Supreme Court came back last month and ruled that the "reliance on Padilla is misplaced." Further, the court said defendants can only challenge their case on these grounds by citing an error that would have prevented a judgment. 

"While ineffective assistance of counsel may render a judgment voidable upon the necessary showing, it does not render the trial court incapable of rendering judgment," the court ruled. 

Though that ruling dealt with the cases of two other immigrants facing deportation, not the case of the immigrant ordered back to Peru, Robertson said he assumed the state Supreme Court decision effectively ended his client's chance at a new hearing. 

"Frankly, I had already told my client he was going to lose," Robertson said. 

Instead, Worcester threw out Robertson's client's guilty plea and reopened the case, scheduling a preliminary hearing for March 31. 

Robertson, while noting that the "fight" is not over, said the ruling was correct, even if unexpected. He said the state Supreme Court had basically taken away defendants' right to seek any "remedy" after the fact should they realize later on that their legal advice was not sufficient. 

"A lot of these people don't figure out they're in trouble ... until immigration comes knocking," he said. 

But Loudoun Commonwealth's Attorney James Plowman, who on Tuesday appealed the decision to the local Circuit Court, said the judge's argument "assumes that there is a remedy for every situation, which there's not." 

Plowman said he was "a little bit shocked" by Worcester's ruling, arguing that for a judge to vacate a ruling years down the road is tantamount to a dismissal. 

"If you start vacating cases that are five and 10 years old, you might as well just dismiss them, because the likelihood of the prosecution being able to resurrect a case that's 10 years old, track down witnesses ... you really ... put our backs to the wall here," he said.