FanDuel Inc. and DraftKings Inc. have been told to shut down in New York, in the latest blow for the daily fantasy-sports industry.

The New York Attorney General’s office said Tuesday that the games constitute illegal gambling and are subject to criminal penalties.

A handful of other states have previously said fantasy sports amounts to gambling and isn’t allowed. But Tuesday’s cease-and-desist order from New York Attorney General Eric Schneiderman is the first time fantasy-sports operators have been formally accused of criminal activity. The attorney general gave the companies five days to respond.

The daily fantasy industry, dominated by FanDuel and DraftKings, faces a federal criminal probe and scrutiny of state legislatures over the legality of their business model and the oversight of their operations.

“Daily fantasy sports is neither victimless nor harmless,” Mr. Schneiderman said in a statement. “And it is clear that DraftKings and FanDuel are the leaders of a massive, multibillion-dollar scheme intended to evade the law and fleece sports fans across the country.”