TOWNSEND — The man might have thought he had figured out how to rob a store when he walked into Honey Land Farms on Main Street on Sunday night with that intention.

His face was covered, and he brandished a long knife. He also allegedly had a getaway car waiting for him nearby.

Police allege that man was Benjamin Short, 26, of 14 Williams St., Ayer, and that waiting in the car were Ryan Coutu, 24, of 29 Tucker St., Pepperell, and Annabelle Johnson, 23, of 19 Francis St., Apt. 2, Fitchburg.

But they say Short wasn’t prepared for what happened when he walked into the convenience store about 8:50 p.m.

Police say several customers watched it all happen and weren’t about to let him get away with it. One grabbed a broom outside the store and hit the suspect with it, according to a store clerk. Another threw a stone at the man, striking him in the head and injuring him, police said.

Townsend police immediately issued an order for police in neighboring communities to be on the lookout. Lunenburg police stopped the three suspects on Route 13.

Townsend and Lunenburg police arrested Short, Coutu and Johnson on Sunday night for their alleged involvement in the attempted robbery at Honey Land Farms at 251 Main St.

Short has been charged with armed assault with intent to rob, Coutu with armed assault with intent to rob as well as being an accessory before and after the fact, and Johnson with accessory before and after the fact.

All three spent the night in jail — with a stop at Nashoba Valley Medical Center in Ayer for Short to receive treatment to his head.

“It’s good that they tried to help her out,” said Jeff Mansfield of Lunenburg, who was shopping at the store Monday, about the good Samaritans who helped the clerk.

“We need more people like that,” said Glen Adams of Ashby, who said he stops in the store almost every day.

A Townsend ambulance transported Short to Nashoba Valley Medical Center to receive treatment for the head injuries. He was later released, according to a press release from Townsend police. The press release did not say, however, whether Short was the one who allegedly brandished the knife.

The incident happened a little more than an hour before the store normally closes. Police rushed to the store after receiving a report of an armed robbery in progress.

The store clerk and several witnesses said a man demanded money from the clerk at knifepoint, but the customers managed to chase him away.

“Just watching it was terrifying,” said Kendra Ganko, a clerk at Honey Land Farms, who learned what happened by watching the security tape Monday. “I watched it about two hours ago, and I’m still shaken up.”

Ganko said a female clerk was working alone Sunday night. She said the security video shows a man walk in, his face covered with what looks like a shirt, while the clerk was in the back room to get some items for a customer. The man goes behind the counter and tries to open the cash register with his knife, Ganko said. When he can’t open the register, he touches the knife to the clerk, who had just come out of the back room.

Ganko said the clerk in the video looks “frozen” and can’t get the register to open — either because of the fear or because she pretended she couldn’t.

The masked man then runs out of the store without money. The video shows a customer grabbing a broom outside and chasing the suspect, Ganko said.

“I was relieved” to see the people trying to help the clerk, Ganko said, adding that it was particularly scary to see the man put the knife against the clerk.

“I don’t know what I would have done,” she said.

Ganko said she called the clerk Monday to see how she was doing, but there was no answer.

Adams, who heard about the incident Monday, said it was brave of the broom-wielder and rock-thrower to try help the clerk.

“The store owner should be grateful of the people who tried to help the clerk,” Adams said.

“They must have felt they had the situation under control,” Mansfield said of the customers.

All of the suspects were held overnight at the Townsend Police Station and transported to Ayer District Court on Monday morning for arraignment on the charges, according to police.