Donald Trump (L) walks in before speaking during a campaign press conference event at the Trump National Golf Club in Jupiter, FL on Tuesday March 08, 2016.

A federal judge in Florida on Wednesday directed a golf club owned by U.S. President Donald Trump to pay $5.77 million to former members who claimed it wrongfully refused to refund their deposits after Trump took over in 2012.

U.S. District Judge Kenneth Marra in West Palm Beach said Trump National Golf Club Jupiter must repay $4.849 million plus $925,010 of interest to 65 former members for breach of contract, following a non-jury trial last August.

Marra said the club had no right to keep the deposits after locking out members who had declared their plans to resign prior to Trump's purchase in November 2012.

Before Trump took over, the club had permitted members who wanted to resign to keep playing golf until their replacements were found.

But Trump changed the rules, declaring in a letter that "as the owner of the club" he did not want such members to use the club, and telling them "you're out."