CHARLOTTE, N.C. — The police officer said he had no choice but to shoot the unarmed man. But prosecutors pushed back hard on Friday as the officer, Randall Kerrick, took the witness stand, challenging his credibility and account of the night he killed Jonathan Ferrell.

“You shot at him 12 times, right?” Teresa Postell, a North Carolina assistant attorney general, asked.

“Yes ma’am,” the officer replied.

She asked if it was true that Mr. Ferrell did not have a weapon.

“I was not aware of that at the time,” the officer protested.

She repeated her question.

“I’m aware of that now, yes, ma’am,” he replied.

Officer Kerrick, who is charged with voluntary manslaughter, testified during the second week of his trial in the killing of Mr. Ferrell early on Sept. 14, 2013. Mr. Ferrell, 24, who was black, had just wrecked the car he was driving and had sought help at a house in a subdivision near the eastern edge of Charlotte. But the woman who owned the house, fearing that he was a burglar, called 911.