After a four-year year battle that included a near-strike, a visible corporate campaign and a series of damning safety-related charges that led to enhanced Federal Aviation Administration oversight, Teamster pilots have signed a contract with Allegiant Travel(ALGT) - Get Report .

While it's too soon to say that all is forgiven by both sides, the end of negotiations appears to benefit all parties.

The new contract took effect August 1, following approval in a 579-90 vote. Of 697 eligible voters, 96% voted.

"Everyone who worked on this is very happy with where it came out," said Dan Wells, an Atlas Air captain who is president of International Brotherhood of Teamsters Local 1224, which represents the Allegiant pilots. "It is a better airline now."

Allegiant has ordered new aircraft, improved its safety culture, and enhanced its ability to retain pilots at a time of a national pilot shortage. Moreover, the contract brings an end to a time of "distraction and anxiety," Wells said. The battle "was very distracting for people who need to concentrate on their work."

The contract represents a vast improvement over a previous in-house pilot agreement that legally was not a contract at all, said Greg Unterseher, director of representation for Local 1224.

An immediate pay raise puts 12-year Allegiant captains at $216 an hour, compared with $213 for a 12-year pilot at Alaska Airlines (ALK) - Get Report. Previously, 12-year Allegiant captains were paid $140 to $160 an hour, depending on the airline's profitability. Top scale for first officers went to $145, compared with $143 at Delta Airlines (DAL) - Get Report.

On pay, "Our benchmarking shows our contract is mid-pack, compared with where everything else sits in the industry right now," Unterseher said.

Allegiant work rules, he acknowledged, are "less mature" than at other carriers, given that the contract is the first ever for Allegiant pilots.

Nevertheless, pilots achieved gains including a 401(k) match that triples a pilot's 5% contribution, as well as "duty rigs" that provide an hour of pay for every two hours pilots are on duty but not flying. Unlike most airlines, Allegiant generally schedules pilots to fly out and back on the same day.

Despite the favorable contract, Allegiant CEO Maurice "Maury" Gallagher remains "virulently anti-union" and continues to have "ideological issues with workers representing themselves," Wells said.

"In the end, I don't think we changed his opinion whatsoever," he said. "But [Allegiant] finally realized we were not going away and we weren't going to back down."

On Allegiant's July 29th earnings call, Gallagher's approach was at least moderately conciliatory.

"I can't tell you how much I'm very pleased to announce that we've completed our historic first agreement with our pilots," Gallagher said, according to a transcriptprovided by SeekingAlpha.com. "First-time labor agreements are traditionally very difficult and time-consuming, usually taking years to complete, and that was the case in our situation.

"It took a great deal of hard work by our pilots' negotiating team, the IBT, and our management negotiating team," Gallagher said. "It's a good deal for both sides."

As a result of the enhanced oversight, Gallagher said, "We and the FAA are partners in our efforts to offer safe air travel to our customers and team members."

Allegiant said the new contract would add $44 million annually in costs. In reports, Cowen & Co. analyst Helane Becker said the contract "should enable the company to hire and retain pilots in the current competitive market," while Deutsche Bank analyst Mike Linenberg said it "removes a significant overhang on the stock."

Shares closed Thursday at $124.89, down 26% year-to-date. Allegiant stock peaked on Aug. 14, 2015 at $232.87.

On July 29, the day after the contract agreement, Allegiant said it would buy 12 new Airbus A320s, the first new aircraft purchase in its 19-year-history. Allegiant's fleet of about 85 aircraft, all bought used, includes about fifty MD-80s, which can now be retired by mid-2019 rather than by 2021.

Aviation and labor experts say the tone of Allegiant negotiations was harsh, but not exceptionally so given that pilots were seeking their first contract.

Ruben Garcia, a professor of labor law at the University of Nevada at Las Vegas, said three factors made the talks difficult.

"The fact that they were dealing with a new bargaining agent had something to do with the tone of negotiations," he said. Also, he said, "the CEO [not being] very friendly to the idea of the union, at least initially, made it a little bit more contentious. [Also], the pilots wanted to strike and were prevented from doing so by the federal court.

"The deal they ended up with is probably in some part related to the fact that negotiations were contentious," Garcia said. "If they were not contentious, there would be less they would have gotten out of it.

As for Gallagher, "I think what it showed is that when he is looking at the future and seeing how he wanted to expand, he was willing to make a bargain," Garcia said.

Aviation consultant Bob Mann said, "First contracts often take three or four years, and [here] the level of acrimony was expanded by fleet reliability issues."

Mann said management likely concluded that getting a pilot deal would enable an aircraft purchase that would "get rid of an aging and problematic [MD80] fleet [and] pay benefits in a couple of ways: lower costs, reduced maintenance costs, commonality and an ability to pay pilots more."

New airplanes "throw off a lot of efficiencies," Mann said.

"What this contract says is that the ultra-low-cost airlines no longer have to be low pilot pay airlines," he said. "They are structurally efficient enough in so many other ways that you can afford to pay people."

This article is commentary by an independent contributor. At the time of publication, the author held no positions in the stocks mentioned.