“It was like a bomb going off,” he said.

The men turned out not to be robbers, but New York City police officers from the elite Emergency Service Unit executing a search warrant. Dressed in tactical uniforms, they had broken down the door without warning and searched the apartment, room to room.

A few hours later, the Police Department’s chief of patrol, Terence A. Monahan, said that Mr. Sanabria, who spoke no English, had confronted two of the officers with a machete. Mr. Sanabria refused an order to drop the weapon and came toward them, the chief said. An officer, later identified as Detective Ruben Leon, fatally shot him once in the chest.

Mr. Conde said that in the seconds before he took cover, he did not see a machete in his friend’s hand. The machete that the police recovered belonged to him, he said, not to Mr. Sanabria. It was a souvenir from the Caribbean — and he kept it behind a door in his room. He said he doubted Mr. Sanabria even knew where it was.

The family of Mr. Sanabria, who worked for decades at an ice cream factory in the South Bronx, has sharply disputed the police account of his shooting.

The police were not looking for Mr. Sanabria, but for his nephew, Miguel Conde. The officers had received information that Mr. Conde — Natalio Conde’s 38-year-old son — had a gun and narcotics in the apartment, the police said.