OAKLAND — A man wearing camouflage clothing who had threatened to kill his ex-girlfriend in the normally quiet Rockridge district was shot to death Saturday morning after pointing what turned out to be a replica assault rifle at police officers as he stood on the porch of the woman’s home, authorities said.

The 39-year-old Oakland man’s name was not released pending notification of his relatives. Officers, the ex-girlfriend and a relative who was also in the house were not hurt.

Residents had earlier called police and described a man carrying what appeared to be an assault rifle and a knife and acting as if he was “patrolling the neighborhood,” said Howard Jordan, the Oakland Police Department’s assistant chief.

Three officers arrived to the 5500 block of Taft Avenue between Broadway and College Avenue a few minutes later, about 9:35 a.m. As screams came from inside the house, the man walked out onto the porch and pointed what looked like an assault rifle at the officers, causing them “to immediately open fire,” Jordan said.

Jordan described the gun as a replica, but said it was capable of firing. Tests will determine its capabilities.

“It looked very real,” Jordan said.

The officers “fired in defense of their lives and of the people inside the home.”

The man had started acting erratically outside his former girlfriend’s home, demanding that she come outside. At one point, he threatened to shoot her, police said.

A relative who lived with the woman called 911. When officers arrived, the man ran inside the house. The woman’s relative ran out screaming, and officers heard the ex-girlfriend yelling for help inside.

Police were about to enter the house when the man came out the front door and pointed the replica weapon at police.

One person who lives nearby described watching the scene unfold through a window and dropping to the floor for safety, then hearing several shots.

As a light mist fell early Saturday afternoon, people in the nearby College Avenue shopping district said they were surprised the type of violence associated with other parts of Oakland happened in the area

“It’s Rockridge,” said a woman who wouldn’t identify herself. “We like to think we’re safe.”

Saturday marked the third fatal officer-involved shooting in the city in a week. On Wednesday, police shot a man wielding two guns after a high-speed chase. Last weekend, an Oakland school police officer killed a man who attacked another officer with a screwdriver.

The shooting Saturday morning is being investigated by the homicide and internal affairs units, as well as the Alameda County District Attorney’s Office. The officer will be placed on administrative leave as is customary in police-involved shootings.

The dead man’s former girlfriend was being interviewed Saturday by detectives, Jordan said.