A Massachusetts man was arrested Wednesday after he allegedly shot at a Lewiston police officer.

Joshua R. Boyd, 27, of Boston was charged with aggravated attempted murder, reckless conduct with a firearm, falsifying physical evidence, refusing to submit to arrest, criminal threatening with a dangerous weapon, possession of a firearm by a prohibited person and violation of conditions of release.

Boyd fired at Lewiston police Cpl. Jeremy Somma about 4:28 a.m. when he went to a Howe Street apartment, where Boyd had reportedly threatened someone with a gun, Lewiston police Lt. David St. Pierre said.

After an exchange of fire, Boyd ran from police and continued to exchange gunfire before he escaped, St. Pierre said.

Neither Boyd nor Somma was hit by gunfire.

Boyd was arrested Wednesday afternoon following a standoff with police on Horton Street, the Lewiston Sun Journal reported.

A Lewiston man, 55-year-old Lee Davis, who allegedly helped Boyd flee from police was charged with hindering apprehension, possession of a firearm by a prohibited person, falsifying physical evidence and violation of conditions of release.

Both men were taken to the Androscoggin County Jail.