A man has been charged with sexually assaulting a woman while holding her hostage for nearly seven hours Friday inside a credit union in Rockford.

Nicholas August, 39, is charged with two counts of aggravated criminal sexual assault as well as armed robbery and aggravated unlawful restraint, according to a statement from Rockford police.

Authorities were called about 2:30 p.m. for reports of an armed robbery in progress at the Heritage Credit Union, 5959 E. State St. in Rockford, police said. Investigators learned August entered the bank, took an employee hostage and ordered the rest of the employees out of the building.

A SWAT team surrounded the building and negotiated with August until he came out with the woman about 9 p.m., police said. He had “a pellet gun that resembled a real firearm” on him when he was taken into custody.

The woman was taken to a hospital for injuries that were not considered life-threatening, police said. During the follow-up investigation, detectives and FBI agents learned August sexually assaulted her during the standoff.

August, who lives in Rockford, was taken to the Winnebago County Jail, where he is being held on $2 million bail, police said. He was also wanted on warrants for domestic battery and probation violation.

He was booked into the jail at 2:19 a.m. Saturday and is awaiting an arraignment hearing, according to Winnebago County sheriff’s office inmate records.

Read more on crime, and track the city’s homicides.