DECATUR, Ala. – An Alabama judge dismissed charges against two teachers because he believes some students can consent to sex, a conclusion that renders the state’s teacher-student sex law unconstitutional.

Decatur High School teacher Carrie Witt and Falkville High School aide David Solomon both faced felony charges for sex with students. Police allege Witt, 44, had sex with two students from her school, aged 17 and 18. The 27-year-old Solomon is accused of sex with a 17-year-old at Falkville High School, reports.

MORE NEWS: VIDEO: Throng of illegals waits to be rafted across Rio Grande

State law prohibits sex between any educator and any student under the age of 19, but otherwise the age of consent is 16.

The Class B felony carries up to a 20 year prison sentence and a requirement to register as a sex offender.

Defense attorneys for the teachers argued that the law violates the 14th Amendment of the constitution by treating school employees differently than everyone else, and Morgan County Circuit Judge Glenn Thompson agreed.

The problem, Thompson wrote, is the law doesn’t consider consent, the employee’s relative authority over the student, or whether the employee abused their power, unlike laws in other states like Texas, Arkansas and Kansas.

“The statute at hand embeds an irrebuttable presumption that any sexual encounter between an employee of any school and any student in the state … is conclusively the result of a misuse of authority,” the judge wrote.

“This court acknowledges that a disparity of power may inherently exist in a teacher/student relationship, but it clearly does not exist in every school employee and every student regardless of where that student is enrolled,” Thompson wrote.

“It is this court’s finding that the law grants these students the capacity to consent until and unless there is some showing that authority was used to obtain illegitimate or coerced consent,” he ruled. “If no such position of authority is alleged, the defendant must be permitted to show consent as a defense.”

MORE NEWS: VIDEO: Ron Paul appears to suffer ‘stroke’ during livestream

Witt’s attorney argued that the teacher was not in a position of authority over her teen lovers when the sex occurred, the Associated Press reports.

Hartselle Police Sgt. Alan McDearmond told Solomon and his victim “met at the school, but communicated through Facebook” and engaged in sex in nearby Hartselle.

Thompson dismissed charges against Witt and Solomon without prejudice.

Morgan County District Attorney Scott Anderson said the state will appeal the decision.

“We’ve already been in touch with the (Attorney General’s) Office and they are going to handle the appeal, which is typical when a state statute is attacked on a constitutional basis,” he said.

Thompson also warned that his ruling applied specifically to Witt and Solomon, and not necessarily to others.

“The Court finds this statute unconstitutional as applied to these defendants,” Thompson wrote in the order. “In finding so, this court does not endeavor to absolve any wrongdoing or to excuse the defendants. Moreover, the court does not encourage any similarly situated party to engage with impunity in what may very well be criminal behavior.”