Two and a half years after texting and driving became illegal in Massachusetts, local towns vary on how strictly they enforce the law.

West Bridgewater, with a population of 7,000, issued 79 texting-while-driving citations over the past year, while neighboring Brockton, population 94,000, recorded three tickets.

The city, which grapples with gangs, busy streets and some serious crime, has to prioritize how officers spend their time, officials said.

“We have a lot happening,” said Brockton police Sgt. Kevin Jones.

An accident in East Bridgewater last week spotlighted the issue.

Police said Jason Monteiro, 34, of Whitman was texting while driving when his SUV rolled over into a nearby swamp. Monteiro has been summoned to court to face a charge of driving to endanger and was given a texting-while-driving citation, police said.

The town has already headed two operations focused solely on the problem.

On Jan. 5, and again on March 2, police held four-hour patrols on a stretch of Route 106. On Jan. 5, police handed out 37 citations and in the March crackdown, 43 citations were issued for texting while driving.

“We’re planning another one shortly, within the next month,” Flaherty said. “It’s made a huge difference here.”

Despite the low numbers of written violations by towns such as East Bridgewater and Brockton, police said texting-while-driving is a common occurrence. East Bridgewater issued three written violations over the past year.

“I look for it as part of my routine patrol,” said East Bridgewater Patrolman Dennis Andre. He said he looks for people who drive with their heads down, looking at their laps.

Easton Police Chief Allen Krajcik said officers will pull up at red lights and look into the car next to them to see if that person may be texting.

But the line between texting and making a cellphone call, which is legal, is often too blurry to give a written violation.

“Most people texting aren’t too overt,” said Krajcik, who did not have the exact number of violations issued in Easton but said it was low.