Top daily fantasy sports companies FanDuel and DraftKings agreed to stop taking money in New York on Monday, amid a monthslong fight with the state's attorney general over whether the games are illegal gambling.

New York Attorney General Eric Schneiderman said the companies had agreed to immediately stop operating paid contests in the state and that an appeal of an injunction against the two companies would be heard in September.

RELATED: FanDuel and DraftKings should return money to losers: Attorney general

Schneiderman also said that if daily fantasy sports are legalized in New York this year, the gambling claims against the companies will be dropped.