A federal judge issued a temporary restraining order against a Hamptons real estate brokerage and three of its agents, after the agents were accused of hacking into a rival’s database to steal information about thousands of homes.

U.S. District Judge Leonard Wexler in Central Islip on Monday blocked Bridgehampton-based Compass Hamptons LLC and Manhattan-based Urban Compass Inc., as well as agents Meg Salem, Vanessa Bogan and Jesse Spooner, from accessing information from the listing database of Bridgehampton-based brokerage Saunders and Associates. Salem, Bogan and Spooner previously worked at Saunders. The lawsuit also named Jessica Grainger-Rozzi, a former marketing administrator for Saunders.

The judge ordered the defendants to “return to Saunders all documents and data” obtained from the database.

Both Compass Hamptons and Urban Compass are units of real estate brokerage Compass. In a statement, a spokeswoman for the parent company said the brokerage has done nothing wrong, and it does not allow its agents to engage “in any of the activities alleged in the suit.”

Salem, Bogan and Spooner did not respond to phone calls seeking comment. Grainger-Rozzi could not be reached.

In its lawsuit, Saunders alleged that with Grainger-Rozzi’s help, Salem, Bogan and Spooner hacked into its password-protected database and stole information about more than 11,600 active and inactive listings, from house alarm codes and the locations of hidden keys to information about previous sales and listings.

It was “a massive theft,” Saunders & Associations president Andrew Saunders said in an interview.

advertisement | advertise on newsday

The data thefts began at about the time Salem — who led the team of three agents — resigned abruptly on Nov. 3 and joined Compass, Saunders charged in the lawsuit. Two weeks later, a Saunders employee discovered that someone had used her credentials to access the database, and the brokerage launched an investigation, according to the lawsuit.

Founded in 2013, Compass is backed by investors including investment bank Goldman Sachs, the family-owned LeFrak company, and venture capital firm Founders Fund, according to its website.

In legal papers, Saunders charged that brokerages Brown Harris Stevens of the Hamptons, Citi Habitats and the Corcoran Group have each filed separate lawsuits accusing Compass of “similar conduct throughout Manhattan, Brooklyn and the East End.”

The Compass spokeswoman called the lawsuits by Saunders and other companies “publicity stunts” by brokerages “seeking to stifle the free will and independence of agents and employees.”