A deputy in South Carolina who was pinned behind his SUV by gunfire for 17 minutes kept talking to the suspect to buy time for backup to arrive, Berkeley County Sheriff Duane Lewis said Wednesday.

Lewis said he can only thank God that the deputy and other officers fired on Tuesday afternoon were not wounded. Deputies killed the suspect, identified by the coroner's office as 51-year-old Joseph Hart.

"The amount of rounds this guy was firing on deputies and police officers, it is a miracle no one was killed on our side," Lewis said at a news conference Wednesday.

The confrontation started after a neighbor complained Hart was speeding down a street in Huger, about 25 miles (40 kilometers) northeast of Charleston, authorities said.

Hart pulled a gun, the neighbor called 911, and when a Berkeley County deputy arrived, Hart hid where he could fire on the deputy and the officer couldn't safely retreat, Lewis said.

According to the sheriff, the deputy and Hart started yelling back and forth as they fired at each other.

"He was trying to have a dialogue with this suspect in my estimation to try to buy time for back up to arrive," the sheriff said of the deputy.

Lewis said it took 17 minutes for another officer to get to the area, which is so rural it doesn't have reliable cellphone service.

But then, officers arrived from everywhere. The sheriff estimated 60 officers were in the area by the time Hart, hiding under a shed, said he would surrender.

Instead, Hart fired at a deputy approaching to arrest him and was killed by officers more than 30 minutes after the shooting began, the sheriff said.

The sheriff's office sent a picture on Twitter of a police SUV with more than a dozen bullet holes.

Lewis said deputies still don't know much about Hart who didn't have a permanent address and was staying with friends in the area. They don't know what set him off Tuesday.

Four officers who fired their guns have been placed on leave as the State Law Enforcement Division investigates, said Lewis, who did not release their names.

Lewis said the deputy who was pinned down was calm during the firefight and the immediate aftermath.

"Afterword when I spoke with him and had some time with him, I think things started to come together for him how close he came to losing his life," Lewis said.