DECATUR, Ala. -- An Alabama judge ruled Thursday that a law barring teachers from having sexual relationships with students old enough to consent is unconstitutional.

Morgan County Circuit Judge Glenn Thompson dismissed charges Thursday against 44-year-old Carrie Witt, a former teacher at Decatur High School, and 27-year-old David Solomon, a former contract teacher at Falkville High School. Witt is accused of having sex with two students who are over the age of 16, the state's legal age of consent. Solomon is accused of having sex with one student over the age of 16.

CBS affiliate WHNT reports that Thompson ruled that prosecutors must prove that the teacher used a "position of authority" to "coerce, groom, or otherwise obtain the illegitimate consent of the alleged victims."

Get Breaking News Delivered to Your Inbox

Thompson said that while there may be a gap in power between teacher and student, it "clearly does not exist between every school employee and every student regardless of where that student is enrolled."

Witt's attorney had argued that the two students Witt is accused of having sex with weren't under her direct authority and were capable of consenting, reports The Decatur Daily.

Morgan County District Attorney Scott Anderson says that he disagrees with the ruling and that Attorney General Steve Marshall will appeal.