SEATTLE -- Washington state law does not bar teachers from having consensual sex with 18-year-old students, an appeals court ruled Tuesday in dismissing a case against a former high school choir teacher. The teacher, Matthew Hirschfelder, was charged with first-degree sexual misconduct with a minor for allegedly having sex with a Hoquiam High School senior in 2006. He challenged a judge's refusal to dismiss his case, arguing the student wasn't a minor because she was 18. Hirschfelder, who was 33 at the time, also denies any sexual relationship occurred. A three-judge panel of the Washington Court of Appeals unanimously agreed that the case should be dismissed. While the law was written vaguely, a review of legislative history shows that lawmakers only intended to criminalize contact between teachers and 16- or 17-year-old students - not those over 18, the court said. "The name of the statute is 'sexual misconduct with a minor,"' said Hirschfelder's attorney, Rob Hill, stressing that the state recognizes that an 18-year-old is no longer a minor. The state's code of professional conduct for teachers still prohibits any sexual advance toward or contact with pupils, whatever their age, and teachers can be fired for it. Sexual contact with students younger than 16 is considered child rape or molestation; the age of consent in Washington is 16. Hirschfelder has not been able to work as a teacher since late 2006, when he was placed on administrative leave pending an investigation by the school board. He was arrested and charged in spring 2007, after a former choir student told police she had a monthslong affair with him that began shortly before she graduated. His case did not go to trial because it was stayed pending the appeals court ruling, Hill said. He has been tuning pianos to make ends meet. Grays Harbor County Prosecutor Stew Menefee did not immediately return a call from The Associated Press, but he told The Daily World newspaper of Aberdeen that he would consider appealing to the state Supreme Court. Some state legislators are set on changing the law. On Monday, six state representatives introduced legislation that would make it a crime punishable by a mandatory minimum of five years in prison for a teacher to have sex with a student up to age 21, as long as the teacher is five years older than the student and at the same school. Rep. Larry Haler, R-Richland, the main sponsor of the bill, said he offered it at the request of the Richland School District, after a judge dropped a sexual misconduct charge against a Richland High School teacher because the teacher's alleged victim was 18. "This is a real concern of mine, and with the court decision today, that just strengthens this bill," Haler said. "We need to protect our students as long as they're in our public schools, irrespective of age."