BANGOR, Maine — A local transient who was carrying a large machete in his belt while walking around the American Folk Festival on Saturday afternoon was arrested, but not without a struggle, Bangor police Sgt. Paul Edwards said Monday.

“He had a machete — a 3- to 4-foot machete,” the sergeant said. “It was scaring patrons. We had several calls.”

Several police officers on patrol at the Folk Festival responded to remove David Tenney, 22, at about 5 p.m. Saturday. A witness said he repeatedly yelled, “I’m allowed to have a weapon,” as police took him away.

It turned out Tenney was right. A judge Wednesday signed an order to modify Tenney’s bail conditions to allow him to have weapons, Superior Court Justice Ann Murray said Monday when Tenney made his first appearance on the new charges. That change apparently did not make it into the computer at the Penobscot Judicial Center before police spotted Tenney on Saturday.

After learning Tenney’s bail conditions had been amended, Tracy Lacher, assistant district attorney for Penobscot County, dismissed the bail violation count that pertained to the machete. The second bail violation charge, which is related to the disorderly conduct allegation, remains, the prosecutor said after Tenney’s court appearance.

During the July incident, Tenney was charged with disorderly conduct and refusing to submit to arrest after he walked into Eastern Maine Healthcare Mall Pharmacy with two large knives on either side of his belt and refused to remove them. Tenney ignored the security personnel’s request, and the officer hit the alarm, calling police. When Officer Tim Shaw and Sgt. Jim Buckley arrived on scene, “Tenney became upset, then began to yell obscenities, was uncooperative and had to be restrained by both officers,” Edwards has said.

Officer Jason Linkletter and Lt. Steve Hunt, who was off duty and was in the area, also aided in subduing Tenney during the July incident, the sergeant said. Shaw suffered minor injuries in the scuffle and was treated at Eastern Maine Medical Center. Tenney also was taken to EMMC for a medical evaluation, and was charged upon his release.

Tenney remained Monday night at the Penobscot County Jail unable to make bail.