A man’s startling decision to have a co-worker hold on to his gun, and the co-worker’s instinct to alert a police officer, ended a killer’s reign of terror in Tampa, Fla., the police said on Wednesday, after arresting a man and charging him in four fatal shootings committed on the streets of a quiet residential neighborhood.

The accused gunman, Howell Emanuel Donaldson III, 24, has no prior criminal history, and even after interviewing him, investigators have no idea why he carried out the four apparently random, unconnected killings, Chief Brian Dugan of the Tampa police said. Mr. Donaldson was charged on Wednesday with four counts of first-degree murder; if convicted, he could face the death penalty.

“That firearm was used in all four murders,” Chief Dugan said at a news conference, adding that Mr. Donaldson had bought the weapon legally a few days before the first killing. “He admitted that he owned the gun, but he did not admit to the murders,” the chief said.

“We were really hoping to find out what was driving him to do this; we don’t have those answers yet,” he said, adding that investigators still do not know why the gunman, who lived in another part of the city, chose the Seminole Heights neighborhood of central Tampa.