A teenager was charged with assaulting a police officer and aggravated criminal trespass after he allegedly broke into a Newfield home with residents inside Saturday and later punched a deputy.

Trevor Cox, 19, of Lynnfield, Massachusetts, was arrested at the Newfield home about 5:30 p.m. after he forced himself inside, the York County Sheriff’s Department said. Cox reportedly screamed while standing on the home’s porch that he was being chased and had taken drugs.

The homeowner opened the door, Cox forced himself inside and grabbed her wrist, agitating her dog, the sheriff’s office said. The dog frightened Cox back outside. A car pulled up with two young men inside, and one of them tried to persuade Cox to leave, but without success, and the two men left.

Cox then put his fist through a living room window, the sheriff’s office said.

A deputy confronted Cox, who was bleeding, and handcuffed him. Cox broke free and started punching the deputy. The deputy used a Taser on Cox several times, but after the Taser completed its cycle he continued the assault on the deputy, the sheriff’s office said.

A second deputy arrived and they restrained Cox. The deputy who was assaulted was treated at a hospital and released.

Cox is being held on $5,000 bail at the York County Jail pending his appearance Tuesday in Springvale District Court.

The car’s two occupants, ages 19 and 20, later contacted the sheriff’s department to report they had tried to calm Cox, who had taken hallucinogenic mushrooms, by driving him around. They were unable to calm him down and Cox had gotten out of the car. Neither man will be charged, the sheriff’s office said.