A 27-year-old man has been charged with assaulting an FBI agent after he was denied entry to the bureau's Buffalo, New York office, federal authorities announced.

Tyler Collins, of Buffalo, was indicted by a federal grand jury on a charge of assaulting a federal officer, U.S. Attorney Trini E. Ross announced Wednesday.

Prosecutors say Collins tried to enter the Buffalo FBI office on July 12 and began yelling expletives and banging on the door when he couldn't get in.

BUFFALO MASS SHOOTING: BIDEN VISITS TOPS SUPERMARKET MEMORIAL, PAYING RESPECT TO VICTIMS

Three agents on their way into the building encountered Collins yelling into the intercom system, prosecutors said. According to the indictment, one of the agents tried to calm Collins and Collins punched him. Another agent discharged pepper spray and Collins fled, prosecutors said. Collins was arrested later that evening.

NYC News

A 27-year-old man is facing up to 20 years in prison for assaulting an FBI agent at the bureau's Buffalo, NY, office while trying gain access to the building.

A message seeking comment was sent to Collins' attorney at the federal public defender's office.

FBI SAYS NEW YORK MIGRANT GANG MS-13 TRYING TO ‘REBUILD’ AFTER INDICTMENT UPDATE FOR STRING OF MACHETE MURDERS

The charge Collins faces carries a maximum penalty of 20 years in prison.