NEW YORK —A state judge has barred daily fantasy sports sites DraftKings and FanDuel from doing business in New York.

The order issued Friday by state Supreme Court Justice Manuel Mendez also denied attempts from the country’s two biggest daily fantasy sports to block the state’s attorney general enforcement action.

Eric Schneiderman has called the games illegal gambling based on chance, not skill. His office sued the companies in state court to force them to stop.

The companies argue their games are based on skill and are therefore lawful.

Messages seeking comment from Boston-based DraftKings and New York-based FanDuel were not immediately returned.