VIRGINIA BEACH, Va. - A man accused of shooting his best friend and then getting into a shootout with police in May 2015 plead guilty to all charges Wednesday.

Christopher Cody Smith faced two counts of Attempted Capital Murder of a Law Enforcement Officer, two counts of Use of a Firearm in the Commission of a Felony and Aggravated Malicious Wounding.

During earlier court hearings, police said Smith had been drinking and started strangling his wife. Smith’s friend tried to intervene, but that’s when Smith grabbed a gun and shot his friend twice — in the stomach and in the back.

When police arrived, they tried to help the two victims but Smith started firing at them from inside an apartment.

Police said Smith came out of the building twice and exchanged gunfire with police.

Smith jumped out of a window and ran into the woods, where he then ran into two officers. That’s when police said Smith complied with commands to stop and drop his weapons. Smith dropped two weapons, but was found with a third weapon in his pants.

During the shooting, Smith suffered one gunshot wound to his leg.

No police officers were injured during the incident.

In court today, several of Smith's family and friends were there. They were tearful as he pleaded guilty.

Kim Williams, a family friend from his church, talked to News 3 after the hearing.

"It makes me want to cry. We were very close, and everyone at the church loved him. I can't say enough good things about him," Williams said.

Smith's defense attorney, John Hooker also spoke to News 3. He said his client is remorseful.

"It's difficult. He's away from his wife, away from his baby, incarcerated, and looking at a tremendous amount of time. He certainly had a bad night, a very sad night. He's very remorseful about it," Hooker said.

Smith will be sentenced in November.

Previous coverage:

Man charged for shooting at Virginia Beach police officers indicted for new charges

Virginia Beach Police Chief talks about morale and department review of four high profile cases

Virginia Beach officers cleared in three recent shooting incidents

No bond granted for man accused of shooting at Virginia Beach police officers