When the puck bangs into the net, a light goes off and fans of the team that scored start whooping in joy.

Well, negotiating a new contract between the Portland Pirates and the management of the team’s home venue, the Cumberland County Civic Center, wasn’t really a game and the two sides weren’t out to defeat each other. Still, fans of the American Hockey League franchise, a farm team of the Phoenix Coyotes, have reason to whoop and holler a bit.

Their team has signed its longest-ever contract with the arena, with the chance that it will be lucrative enough that the team will potentially post its first operating profit in 13 years, according to CEO and managing owner Brian Petrovek.

The contract, which will last five years, calls for the team for the first time to get a share of concession revenue — and not a small one, either.

The Pirates will in fact get 57.5 percent of the money fans spend on food and beverages at the civic center’s nosh stands.

And the team will get a break on the rent, with its payments dropping from a maximum of $2,500 per home game to a fixed rate of $1,000.

That sum eliminates rebates the civic center paid to the team if too many seats were left unfilled.

The new pact comes as the civic center is undergoing a $34 million renovation to make it more attractive for a wider variety of events, including concerts. The changes include modernizing concession areas, renovating backstage areas and improving some seating areas, including installation of new luxury seating areas.

The agreement requires the Pirates to play all their home games in Portland after the renovations are complete, a goal that has been delayed but is now expected to be reached in January 2014. The Pirates are expected to play home games at the Colisee in Lewiston until then.

The new lease ends speculation that the team might consider moving to another location. The current lease it replaces was just for one year, and was negotiated at a time when the Pirates were being wooed by the city of Albany, which had lost its AHL franchise.

Now, things are on a better footing for both the team and the civic center, as the arena can begin scheduling other events with the Pirates’ home games as an anchor.

The team has been a vital asset to the city and the region for many years. Now that association will continue for at least another half-decade.

They shot, they scored.