WASHINGTON (NBC) -- When the student government at Tenino High School in Washington state started brainstorming about how to raise money for a good cause, they thought Justin Bieber might be able to help.

Their idea: blast a Bieber song over the school's loud speaker — on repeat — and charge people to make it stop.

"We decided that playing one song over and over would be more annoying to really get it stuck in their head," student government president Conner Stakelin, 17, told TODAY.com. "We considered it motivation for them to donate."

Student leadership played Bieber's hit "Baby" throughout the day to raise money for their sister school Crossover International Academy in Ghana, which provides education for more than 254 orphaned students.

Starting Monday, the song played during all six of the 5-minute passing periods and during both 30-minute lunch breaks. The only way the students and teachers could stop the music was to raise $500 to send to Ghana.

It turns out that Bieber was just what they needed — the money came pouring right in.

The music finally stopped Tuesday afternoon, when they reached — and then exceeded — their $500 goal. Two students donated over $100 each, and community members helped out. Even a local radio station featured the high school on air and donated $500. Altogether, the students raised more than $1,000.

The student government decided to help the school in Ghana when they learned during a presentation that $1,200 would give the students more food and classroom space. Student council member Krystal Glenn came up with the idea of the "Bieber Blast," and the council decided raising $500 was doable for the 355 members of their student body.

While some students liked the music, most wanted it to end. Many put their heads down on their lunch tables and covered their ears, Stakelin said, while others could be heard shouting in the halls, "I hate this music!" Teachers wore headphones during the musical breaks.

"Some students called their grandparents and said, ‘It's such a great cause, will you donate? Also I want the music to stop,'" Stakelin said.

Tenino High Principal Dave Chappell said he's proud of his students' efforts.

"Luckily I was at a conference during part of the time so I was spared some of it. But it was a fabulous experience for the kids," he said. "It was just a constant reminder of the cause."

The fundraiser has now moved online to a GoFundMe web page, where students hope they can continue to crowdsource donations for students across the world.

"In a weird way it really brought the whole student body together, working to raise money for a good cause," Stakelin said. "I think we'd definitely do it again."