The United States has a patchwork of rules on noncompetes. Only California and North Dakota ban them, while states like Texas and Florida place few limits on them. When these cases wind up in court, judges often cut back the time restraints if they’re viewed as unreasonable, such as lasting five years or longer.

“In most states there has to be a legitimate business interest, and it has to be narrowly tailored and reasonable in scope and duration,” said Samuel Estreicher, a professor at New York University School of Law.

Daniel McKinnon, who had been a hairstylist in Norwell, Mass., lost a court battle with his former employer who claimed that Mr. McKinnon had violated the terms of his agreement when he went to work at a nearby salon. Mr. McKinnon said that he did not think the original restriction — to wait at least 12 months before working at any salon in nearby towns — still applied because he had been fired after years of friction with the manager there. Shortly after being fired, he went to work at a nearby salon.

But a judge issued an injunction ordering him to stop working at his new employer.

“It was pretty lousy that you would take away someone’s livelihood like that,” said Mr. McKinnon, who for the following year lived off jobless benefits of $300 a week. “I almost lost my truck. I almost lost my apartment. Almost everything came sweeping out from under me.”

He resisted the idea of traveling miles from his apartment to a new salon, saying that would have meant an unpleasant and costly commute.

“The salon where I worked was doing just fine — I don’t see why they needed to do this,” he said. “I basically had to give up a year of working.”

Wendi S. Lazar, an employment lawyer in Manhattan, said she saw an increase in litigation to enforce noncompetes. “Companies are spending money, hiring lawyers, to go after people — just to put the fear of death in them.”