VASSALBORO — The turnaround began in the spring, right around the time the members of the Erskine Academy golf team gathered in Mark Bailey’s classroom to promise their coach that there wouldn’t be another also-ran finish at the state championships.

“They dropped by my classroom and said ‘Coach, we’re going to be really good,’ ” Bailey said. “All of them, really.”

Turns out it was more than just bravado. The Eagles recorded a score of 317 from their top four players Saturday at Natanis Golf Course to beat defending champion Cape Elizabeth (325) and win their first Class B state championship. Old Town (331) was third, followed by Yarmouth (333).

“It’s unbelievable,” Bailey said. “We’ve finished fifth, sixth and seventh the last three years, and just to get into that top spot, it’s like a dream come true.”

Gorham had five players shoot 82 or better and needed each one to clip Mt. Ararat in a tiebreaker for the Class A title.

Both teams finished with a score of 317, so the championship was decided by each team’s fifth-best score, and Cam Stevens carded an 82 for Gorham.

Falmouth (322), Scarborough (323) and Greely (327) finished close behind the top two teams.

Ryan Kaczmarek led Gorham with a 77. He was backed up by Lucas Roop (79), Brandon Desjardin (80) and Marc Yankowsky (81).

“They all played to their potential today,” Gorham Coach Rick Altham said of his team. “That’s what we talk about all season long, how important it is for every player to fulfill their role.”

There wasn’t as much drama in Class C. Mattanawcook Academy rode two-time defending individual champion Logan Thompson’s 4-under 68 to a second straight championship, scoring 311 to beat St. Dominic (329), Winthrop (347), Dirigo (350) and Houlton (352).

“I felt like I had the potential to have a breakout round but I had everything going today,” said Thompson, who posted the best score across all three classes. “I just had to get a putt to fall to build my confidence, and then I took it from there.”

Confidence was in ample supply among the Erskine players, even with a Cape Elizabeth team that returned last fall’s individual champion – Ryan Collins. The Eagles qualified two freshmen for last year’s individual championships, rolled to the Kennebec Valley Athletic Conference Class B championship in the regular season, and had the home-course advantage at Natanis’ 36-hole course. They knew they’d be in the mix – and with a break or two, leading it.

“These guys are out here every day, they know every inch of this golf course,” Bailey said. “We thought we’d be one of the contenders, but the southern Maine schools have just been so strong in this tournament.”

Cape Elizabeth got a 76 from Austin Legge and a 79 from Lauren Schonewolf but couldn’t muster the depth necessary to add a seventh state title.

“We knew we were coming to someone’s home course and we’d have to play that much harder, grind that much harder,” Coach Chris Whitney said. “In all honesty, I think if you asked my own team, they’d tell you that there are three people up there that would really like to go and start again. … The kids have higher expectations.”

Gorham secured its fourth title and first since 2012.

“You see that you’re tied, you just don’t know what’s going to happen,” Altham said. “And then that final score goes up, it’s like a big gasp that they actually did it. I’m just so proud of the team.”