A Dallas police officer fatally shot a neighbor inside the man’s apartment late Thursday night, claiming that she mistook his apartment for her own and believed he was an intruder, the police said.

After completing her shift on Thursday, the officer went to her apartment building across the street from the Dallas Police Department’s headquarters shortly before 10 p.m. But the officer, who was still in a police uniform, did not go to her own unit and instead tried to enter the residence of a neighbor, Botham Shem Jean. She then shot him, the authorities said.

Mr. Jean, 26, was taken to a hospital, where he was pronounced dead.

In a brief statement on Saturday night, the police identified the officer as Amber Guyger, a member of the department for four years. It was not clear how she mistook where she lived or why she opened fire.

Chief U. Renee Hall of the Dallas Police Department had originally said that investigators were seeking an arrest warrant to charge the officer with manslaughter. But then the Police Department turned the investigation over to the Texas Rangers, the state’s top law enforcement agency.