A north Alabama judge has declared the state's teacher-student sex law unconstitutional and dismissed charges against two school employees who are accused of having sex with students.

Morgan County Circuit Judge Glenn Thompson issued a ruling today dismissing the charges against former Decatur High School teacher Carrie Witt and David Solomon, an ex-aide at Falkville High.

Witt and Solomon

"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."

Judges have been asked to dismiss the charges based on unconstitutionality in other cases, but they have declined to do so.

"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," Morgan County District Attorney Scott Anderson told AL.com.

The law prohibits any school employees from having sex with students who are younger than 19. If teachers or other school employees violate the law, they can be charged with a Class B felony that carries a punishment up to 20 years imprisonment. The law also requires they register as sex offenders if convicted. Consent is not a defense.

Defense attorneys have argued teachers' 14th Amendment equal protection rights are violated by the law that was created in 2010. The law treats teachers and other school employees differently from other citizens, the attorneys argue in court records. Other adults having consensual sex with 16-year-olds do not face criminal prosecution. State prosecutors have argued the law is constitutional and designed to protect students.

Thompson wrote that because of how the law is written, courts are unable to determine:

whether the parties were consenting adults

whether the school employees were in positions of authority over the students

whether the employees abused their power to coerce or groom the students, or to obtain illegitimate consent

"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," Thompson wrote. "If no such position of authority is alleged, the defendant must be permitted to show consent as a defense."

It's not yet clear how Thompson's ruling might affect other cases across the state.

"Until the appellate courts have addresses the issue, I think it will depend on how individual judges rule on the law," Anderson said.

Witt, 44, was arrested in March 2016 when police said she had sex with two teenagers -- one who was 17 and the other 18 -- when they were her students at Decatur High. Witt was a history, psychology and social studies teacher, who also coached girls' golf and junior varsity cheer.

Thompson wrote that while the state has a legitimate purpose in protecting certain classes of people, like students, prisoners and patients from being coerced by teachers, wardens or doctors, the law doesn't narrowly address that issue.

"The statute at hands 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. Thompson said the law is problematic because it doesn't consider whether the school employee and student are in the same class, school or school system.

Solomon, a 27-year-old from of Huntsville, was accused of having sex with a 17-year-old student while he was working at Falkville High. The alleged sexual contact between Solomon and the victim happened, however, in nearby Hartselle, said Hartselle police Sgt. Alan McDearmond.

"They met at the school, but communicated through Facebook," McDearmond said in an email.

Thompson cited student-teacher sex laws in other states that he believes are constitutional. Those include laws in Texas, Arkansas and Kansas. Those laws either implicitly address sex between students and employees who exercise power over them, or students and employees at the same school.

"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.

Updated Aug. 11, 2017 to correct information about Solomon's case. While Solomon's sexual contact allegedly happened in Hartselle, the student was enrolled at Falkville, where he was an aide.