A Missouri man is in custody after police said he broke into a home in Farmington and fired shots while police were inside early Sunday morning.

Farmington police said the suspect, who is now in custody, broke into a home and fired shots inside the home before being shot and arrested by police at around 4 a.m.

According to a press release from the Farmington Police Department, police responded to Dawn Street for a burglary in progress call. When they arrived, they found a window broken out in the back of the house. They spoke to the homeowner, who said there was someone in the basement of the home.

After evacuating the residents from the home, police went into the basement, where they saw an empty gun case and boxes of ammo. An officer heard what he thought was someone loading a gun, so the officer began shouting commands.

The suspect did not respond, then fired multiple shots in the basement.

Officers fled the house while gunshots continued. They took cover outside the house, and when the man came out the front door with what police said was an assault rifle, they fired a shot that hit the man in the side.

The man was treated by first responders and taken to the hospital. He was later released into police custody.

Police have filed charges against the man to the St. Francois County Prosecuting Attorney's Office.