NEW YORK --  The legal battle has been going on for months, but on a Monday without much warning, the New York State Attorney General's office and two primary daily fantasy sports companies found some common ground.

"This form of the agreement was really crafted over the course of the last week or so but the ideas, the ideas emerged from discussions that have been going on for months," said Eric Schneiderman, D-New York.

More than four months after receiving cease and desist letters, DraftKings and FanDuel have agreed to stop taking money in New York.

"I'm a little surprised it didn't happen sooner with respect to the fact that the payment processors, the credit card companies, becoming increasingly uncomfortable with the continuing saga, especially since as I said, they did lose at the lower court level so the odds against them winning the next round weren't good to begin with," University at Buffalo sports law professor Nellie Drew said.

In December, the State Supreme Court ruled in favor of the state but the companies were able to continue operating thanks to an appeal that's still pending.

"This does not end our legal action against DraftKings and FanDuel but it is a tremendous step," Schneiderman said.

The deal also allows for parts of the litigation to be resolved more quickly if the appellate division makes a ruling or the law changes. The state legislature is considering ways to regulate the industry.

"Obviously, it would be a lot more conducive to that if they were to approach the legislature in a cooperative manner as opposed to an adversarial one, having demonstrated their commitment to cooperate with existing New York State regulation and of course the attorney general himself," Drew said.

Drew said the agreement will likely affect lawsuits in other states as well.

"I would assume other jurisdictions will expect them to do the same, the exception to that being Virginia which did recently pass legislation regulating daily fantasy sports," she said.

The attorney general said the agreement will have no effect on the state's consumer fraud and false advertising claims against the companies.