For months, some sheriffs and police officers in rural counties bordering Colorado have complained that they have seen more marijuana entering their towns and being transported down their highways since recreational sales began in January. Oklahoma and Nebraska said the influx had led to more arrests, more impounded vehicles and higher jail and court costs. They say it has also forced law-enforcement agencies to spend more time and dedicate more resources to handling marijuana-related arrests.

“We’re seeing a lot of marijuana coming over from Colorado,” said Sheriff Adam Hayward of Deuel County, Neb., who said that he was gratified that the two states were challenging Colorado’s marijuana laws. He has complained that marijuana arrests have strained his jail budget. “For the longest time we were saying, this is becoming a problem for us.”

Colorado’s attorney general, John Suthers, a Republican, said in a statement that the challenge from Nebraska and Oklahoma was “without merit.” Like many elected officials in Colorado, Mr. Suthers had opposed Amendment 64, which legalized marijuana. But on Thursday, he said “we will vigorously defend” against the lawsuit attempting to undo it.

Nebraska and Oklahoma’s challenge is aimed more at the commercial side of marijuana legalization, which created new systems of regulations and taxes as well as recreational stores, dispensaries and production facilities that are monitored and licensed by state officials. The suit does not specifically seek to overturn the portion of Amendment 64 that made marijuana legal for personal use and possession, meaning that portions of legalization could survive even if Nebraska and Oklahoma prevail.

But marijuana advocates said that the challenge — if it succeeds at shutting down marijuana retailers — could boost the black market.