BANGOR, Maine — Bangor residents gave the go-ahead for a $3 million loan to replace Bangor Public Library’s century-old copper roof and approved the city’s $42 million school budget during Tuesday’s election.

In an “unprecedented” turnout for a June election, just over 2,200 Bangor residents voted, City Clerk Lisa Goodwin said Tuesday night, soon after election officials finished hand-counting ballots. Polls at the Cross Insurance Center closed at 8 p.m. and counting continued for nearly three hours.

It’s the largest turnout for a special election since the 2011 arena vote.

Support was high for all three measures, according to unofficial election results released shortly before 11 p.m. The school department’s budget received 1,773 votes in favor versus 406 against and 23 blanks. The question asking whether voters wanted to continue to ratify school budgets on an annual basis for the next three years was the tightest, with 1,271 in favor, 899 against and 33 blanks. The library roof replacement bond passed overwhelmingly, with 1,852 supporting, 248 opposing and 4 blanks.

Among those voters were two of the Queen City’s most famous residents, Stephen and Tabitha King, who came out early Tuesday morning shortly after polls opened to support the library roof measure. The Kings pledged $3 million toward a planned $9 million renovation and modernization project at the library, but only if the city’s residents passed the roof bond and the library raised another $3 million on its own.

“We’re delighted, and very happy to be from a city that cares about its cultural heritage and wants to protect it,” the Kings said in a brief statement late Tuesday night. “Bangor voters did a fine thing today.”

Library officials said during a recent meeting with the Bangor City Council that they are more than halfway to raising their share of the $3 million.

The roof bond would have passed automatically in this election, even if it had failed to receive support from a majority of voters, if fewer than 2,200 had showed up to vote. Under a charter amendment passed by Bangor voters in the November 2012 election, a referendum is required if a bonded project exceeds a certain dollar amount. However, that amendment states that in the election 10 percent of the city’s registered voters, or roughly 2,200, have to turn out for a “no” vote to be successful. Had voters not passed the measure, city officials would have had some very careful math to do.

Also in Tuesday’s election, voters decided they will continue to vote to ratify the Bangor School Department’s budgets at special elections for the next three years. The City Council approved the school budget during a meeting earlier this month.

The budget is “bare-bones” in a year when neither the school system nor city know for sure what severe fiscal challenges they might face when the state passes its own budget, according to school Superintendent Betsy Webb.

The school budget is $738,837 higher than this past year’s adopted budget, or a 1.79 percent increase.