A security officer fled from a restaurant in Takoma Park early Sunday pursued by an angry man with a machete who had already used it on him once, authorities said.

On spotting the goings-on, a police officer got out of his car and intervened, the Takoma Park police department said. They said the officer had gone to the area, in the 7600 block of New Hampshire Avenue, after getting information about gang activity.

Identifying himself to the man with the machete, the officer ordered him to drop the weapon, police said.

The machete was dropped, police said, and the man ran, touching off a brief chase on foot.

After investigating the 1:45 a.m. incident, police said they learned that earlier the security officer had told two people at the restaurant that they could not leave with an open container of alcohol. The two became angry, police said, and left.

But they came back a short time later, and attempted to confront the security officer. One of the two charged at him, with his fists raised, and was pepper-sprayed, police said. The second man then produced a machete, police said, and struck the officer in the head.

The officer’s injury was not life-threatening, police said.

Police said Elder Molina-Umana, 23, of Hyattsville, and Antoni Rivas-Melendez, 24, of Glen Dale were arrested in connection with the incident.