By Kevin Murphy

KANSAS CITY, Kan. (Reuters) - A 20-year-old man accused of fatally shooting a Kansas City, Kansas, police officer has been charged with capital murder, prosecutors said on Thursday.

Wyandotte County District Attorney Jerome Gorman told a news conference that Jamaal Lewis shot police Captain Robert Melton, 46, who was pursuing him following reports that shots were fired from a car into an apartment building,

Lewis, who has no known criminal record, was the driver of the car, but got out and was on foot when he fired at Melton after the officer arrived in his squad car, Gorman said.

National attention has been focused on attacks on law enforcement officers following the recent ambush killings of eight police officers in Dallas and Baton Rouge, Louisiana. But Kansas City police said on Wednesday that Melton's death was not a premeditated attack.

Lewis used a .40-caliber handgun to shoot Melton, but was not carrying the gun when captured by police without resistance shortly after the Melton shooting, Gorman said.

A decision has yet to be made on whether Lewis will face the death penalty, Gorman said. Lewis is being held on $10 million bond. He is not believed to have an attorney yet, a spokesman for Gorman's office said.

Lewis was also charged with aggravated assault and criminal discharge of a weapon at an unoccupied dwelling in connection with shots fired at the apartment building, Gorman said.

Gorman said the suspect who shot at the apartment, Daqon Sipple, 18, was also charged with aggravated assault and criminal discharge of a weapon, but was in custody by the time Melton was shot.

(Reporting by Kevin Murphy, Editing by Ben Klayman)