The New York Mets' owners got the Bernard Madoffmonkey off their backs with the settlement of a $303 million lawsuit Monday and promised long-suffering fans they would revitalize the team.

Further improving their financial outlook, the Mets completed the sale of 12 minority shares of the team for $240 million and repaid $65 million in loans, according to sources familiar with the situation.

Manhattan federal judge Jed Rakoff announced the lawsuit agreement in court just minutes before he was to pick a jury for the $303-million suit brought by Madoff trustee Irving Picard against Fred Wilpon, Saul Katz and their partners at Sterling Equities.

The partners agreed to pay back over five years $162 million in fake profits they received from the Ponzi scheme.

But their net obligation is likely to be much less than that amount, because Picard agreed to allow Wilpon and his partners to file a claim for $178 million lost in the fraud and use that amount to offset what they owe. If Picard recovers enough from other "winner" investors to pay the losers 90 percent of their investments, the Mets' owners would break even.

Wilpon and Katz's relief was evident after a 15-month court fight that had cast doubt on their financial ability to hold onto the baseball franchise.

Next step: Eyes on team

Subscribe to Newsday’s sports newsletter

Receive stories, photos and videos about your favorite New York teams plus national sports news and events.

"Now I can smile again," Wilpon said outside court. "Our first priority is getting down to Florida tomorrow to try to bring the New York Mets back to prominence. Our fans deserve it."

As part of the deal, Picard agreed to drop his claim that the Sterling partners turned a "blind eye" to Madoff's $50-billion fraud, the largest scam in Wall Street history, by ignoring warnings that their profits were too good to be true.

"As we've said all along, the fact is we have done everything in good faith. This settlement itself bears that out," Wilpon said.

The two sides agreed not to take potshots at each other in public as they often did over the past year, and they put a positive spin on the deal.

David Sheehan, counsel to Picard, said the trustee "believes that this settlement represents the best possible outcome for [Madoff] customers with allowed claims, as it provides for the recovery of 100 percent of the $162 million in fictitious profits for the six-year period. We believe that this is a fair and just settlement."

The agreement, which eases pressure on the financially stretched owners, was brokered Friday night by former Gov. Mario Cuomo, who served as a mediator in the case for the past year.

Mixing persuasion and hard realism, Cuomo painted for both sides a stark picture of the unpredictable nature of trials and the years of expensive appeals that could follow.

"The principal force was proximity to trial," Cuomo told Newsday. "As the parties got closer to trial, they got closer to the realities of trial."

Both sides made concessions. Picard, who had at one time sued for up to $1 billion -- a claim trimmed back by Rakoff -- finally agreed to take $162 million in six years of fake profits, a number he had sued for earlier in the case.

Wilpon and Katz agreed to drop their appeal to the U.S. Supreme Court of a crucial ruling that backed Picard's method of approving claims. They put themselves on the hook for up to $29 million if the Sterling partners still owe money after three years.

'Victory' for both sides

Jerome Reisman, a Garden City lawyer who represents other Madoff victims, called the deal an "unbelievable major victory for the Wilpon-Katz group."

"For the Mets, it allows them to go and forcefully put their resources into the development of good baseball," he said.

The extended-payment plan also gives the Wilpon group breathing room, said Anthony Sabino, a professor at the Peter J. Tobin College of St. John's University.

"You're spreading it out over time and that is very helpful for the Wilpons," said Sabino.

Winning back estranged fans may also take time.

"The Mets have been leaving a bad taste in my mouth," said Todd Rock, 45, of Freeport, who said he hasn't gone to a game in years. "The bad players. The scandals."

Drew Velting, 50, of Bellmore, said he hoped the settlement would bring "less disruption to the team and the players and the fans."

His son, Otto, 7, doesn't know about the legal issues. But he knows that losing star shortstop Jose Reyes as a free agent during the winter because the Mets couldn't afford him made him "really sad, because he was my favorite player."

The settlement drew boos from smaller investors who lost money to the Madoff fraud.

It's a "sweetheart deal," said Michael DeVita, 61, of Chalfont, Pa., who saw his retirement nest egg and his parents' life savings go down the tubes.

Ronnie Sue Ambrosino, a former Long Islander financially wiped out by Madoff who lives in Arizona now, said, "I'm really disappointed in the fact that it didn't go to trial, because now the little investor will never know the facts."

But Reisman said the deal gives Picard "a leg to say he got as much as possible" while avoiding the risk of a loss at trial that might have fatally damaged his credibility.