ST. ANTHONY, Minn. — A lawyer for the suburban police officer who fatally shot a black man during a traffic stop said on Saturday that the race of the driver, Philando Castile, played no role in how his client responded, and that the officer “was reacting to the presence of a gun” when he opened fire.

The comments from the lawyer, Thomas Kelly, provided the fullest accounting yet of Officer Jeronimo Yanez’s version of the shooting Wednesday night, even as many details remain unclear.

Officer Yanez, of the St. Anthony police, is on leave while state authorities investigate the shooting, which has prompted protests and raised questions about what role race might have played in the stop.

“The shooting had nothing to do with race and everything to do with the presence of that gun,” Mr. Kelly said in an interview, noting that Officer Yanez is Latino.