HAMILTON, Mont. (AP) — A former Hamilton High School teacher has been sentenced to 30 days in jail after being charged with providing alcohol to and having sex with a 15-year-old student in January 2010.

The Ravalli Republic reports 27-year-old Gage Colby Brumwell was given a three-year deferred sentence Wednesday with the 30 days in jail after pleading no contest to felony criminal endangerment. He was given a six month jail sentence, with five suspended, after entering an Alford plea to misdemeanor sexual assault. The sentences run concurrently.

Prosecutors alleged Brumwell sent and received explicit text messages from the student. The girl said she drank alcohol at his house and they had sex.

Brumwell admitted to the text messages and having the girl over, but denied any drinking or sexual activity.

He resigned in December 2010.