Professional gambler Billy Walters came up on the short end of an insider-trading scheme that involved golfer Phil Mickelson when a Manhattan federal judge sentenced him to 5 years in prison on Thursday.

“Billy Walters is a cheater and a criminal and not a very clever one,” said U.S. District Judge P. Kevin Castel, who also imposed a $10 million fine on Walters for masterminding a scheme in which the judge said profits and avoided losses exceeded $25 million.

Walters, 71, a multimillionaire sports gambler and cardplayer from Las Vegas who owns a string of golf courses and car dealerships, was convicted in April of trading for years on tips from former Dean Foods chairman Thomas Davis that prosecutors say netted him $43 million.

Mickelson, a friend of Walters, was never charged, but repaid nearly $1 million he made trading on Dean Foods on the advice of Walters, whose defense at trial was that he was a brilliant investor who had used his intuitive gambling genius to make money on the stock market.

The golf superstar owed Walters gambling debts, according to the government, and used his $931,000 profit to pay back part of the money. Castel alluded to Mickelson when imposing sentence, saying that Walters in addition to profiting directly also used tips to enable a friend to pay off a debt. He did not name Mickelson.

Walters’ defense lawyer, Barry Berke, citing letters from Walters’ acquaintances that recited his good deeds and kindnesses, asked for a sentence of a year and a day. Prosecutors urged the judge to “send a message” by imposing a sentence within federal guidelines of 97 to 121 months.

advertisement | advertise on newsday

Castel said Walters had an adjusted gross income of $175 million from 2011 to 2015, and was motivated by greed.

“He had amassed a fortune,” the judge said. “Walters was fixated on appearing to himself and others to be a winner. At this point in his life, money was mostly a way of keeping score.”

Walters made no plea for leniency during his remarks in court, limiting himself to thanking Castel for reading the letters submitted on his behalf.

After his conviction, Walters told reporters that he had lost “the biggest bet of my life,” but he declined to comment on Thursday. He is expected to appeal.

Acting Manhattan U.S. Attorney Joon Kim, said in a statement: “Making millions in the stock market with a deck stacked in your favor leads to time in a federal penitentiary. For the integrity of our securities markets, that is the blunt lesson our insider trading prosecutions must teach.”