A Rhode Island man who engaged in a gunfight with police officers responding to reports of an armed man inside a Massachusetts church has been sentenced to up to 15 years in prison, prosecutors said.

Eric Lindsey, 45, of Coventry, Rhode Island, was sentenced Monday in Superior Court after pleading guilty to armed assault with intent to murder, breaking and entering, and several gun charges, the Bristol district attorney's office said in a statement Tuesday.

Two officers went to the Assembly of God church in Attleboro after the pastor called 911 and reported seeing an armed man inside the building at about 6:30 a.m. on Aug. 27, 2018, authorities said.

GOVERNOR OF RHODE ISLAND TO SIGN 3 GUN CONTROL BILLS

Boston, Plymouth, Worcester news

Rhode Island man charged with shooting at police officers.

The officers saw Lindsey nearby and ordered him to stop and drop two backpacks he was carrying. Instead, he opened fire at one officer and both officers returned fire until Lindsey fell to the ground and dropped a gun, authorities said.

POLICE: 9 WOUNDED, 3 CRITICALLY, IN PROVIDENCE, RHODE ISLAND SHOOTING

Neither officer was struck by gunfire, but bullets struck one cruiser's windshield, and driver's seat and headrest. Lindsey's femoral artery was severed by a bullet and his life was saved by the officers who applied tourniquets, authorities said.

Lindsey had two handguns, as well as multiple high-capacity magazines and loose ammunition, authorities said.