EAGLE, Idaho — A former teacher and head basketball coach at Eagle High School has been arrested on several felony charges, including rape, sexual battery of a minor and sexual exploitation of a child.

Jeff Ranstrom, 32, of Star, was booked into the Ada County Jail late Wednesday afternoon.

According to the Ada County Sheriff's Office, Ranstrom had a "lengthy sexual relationship" with a 17-year-old girl.

Detectives began their investigation last week after being contacted by a third party, sheriff's spokesman Patrick Orr said. Authorities believe Ranstrom and the girl had illegal sexual contact dozens of times between March and August.

The alleged sexual contact occurred at homes and other places in Star, Meridian, Eagle, and Boise.

Jeff Ranstrom mug
Jeff Ranstrom
Ada County Jail

Ranstrom appeared in court Thursday afternoon for a video arraignment.

HIs lawyer says his client is the one who came forward. He reportedly told his lawyer, who then contacted law enforcement.

Ranstrom is facing six felony counts -- including rape, sexual battery of a child, and sexual exploitation of a child.

Lawyers said it all stems from a relationship he had with a former student.

Prosecutors say Ranstrom targeted the girl from the time she was a freshman.

Several former students were in court Thursday to hear the charges against Ranstrom.

One of them told us he was shocked to hear the details.

"It just shows you that the world we live in today is really unpredictable, it was said she was a family friend so you never know. You just never know, could be your next door neighbor you just never know," said Braeden Stevens.

According to Ranstrom's attorney, he told his family he's guilty of these crimes.

Ranstrom will be back in court on October 17.

His bond is currently set at $500,000.

West Ada School District spokesman Eric Exline confirmed to KTVB that Ranstrom resigned his position with the school on September 23. In addition to coaching the boys' basketball team, he was also a social studies teacher, Exline said.

The sheriff's office is asking anyone who may have information on the case to contact Detective Neil Daigle by email at ndaigle@adacounty.id.gov or by calling (208) 577-3704.

RELATED: Idaho IceWorld coach arrested on child pornography charges

RELATED: Former Columbia High football coach arrested on drug charges