Arkansas man says he planned attack on cop who was accompanied by family

An Arkansas man was arrested in July after he attacked a police officer and admitted to planning the assault, officials said.

Cody Ramsey, 22, was sitting inside of a parked pickup truck on July 18 outside of Officer Andrew Napolitano's house near the officer's vehicle, the Beebe Police Department wrote on Facebook.

Napolitano and his two children were getting into the officer's vehicle when he noticed Ramsey, and asked if he was waiting for someone, to which Ramsey allegedly replied he wasn't.

The Beebe officer reportedly told Ramsey the area was private property and asked him to leave.

LAPD RELEASES VIDEO OF FATAL POLICE SHOOTING OF FEMALE HOSTAGE HELD AT KNIFEPOINT

Ramsey, according to police, "then leaned forward in his car seat and pulled out a semi-automatic handgun and pointed it at Officer Napolitano's face."

The officer reportedly then pulled out his own gun and ordered Ramsey to drop his and to get out of his pickup, both of which he did.

After Ramsey got out of his car, he allegedly attacked Napolitano by "striking him" in the face several times.

A witness stepped in to help the officer and subsequently suffered minor injuries. 

DAD KILLS WIFE, SON AND EX-WIFE AMID BITTER TRANS-ATLANTIC CUSTODY BATTLE, POLICE SAY

The department said Ramsey resisted arrest, but was taken into custody when other officers arrived at the scene.

Ramsey admitted to preplanning his attack on Napolitano, according to police. He was charged with aggravated assault, battery in the second degree on a law enforcement officer, and carrying a weapon.

Nicole Darrah covers breaking and trending news for FoxNews.com. Follow her on Twitter @nicoledarrah.