By David Bailey

MINNEAPOLIS (Reuters) - A Minnesota police officer who fatally shot a black motorist during a traffic stop this week was reacting to the presence of a gun, not the man's race, his lawyer said on Saturday.

The fatal shooting of Philando Castile, 32, on Wednesday night in a St. Paul suburb has sparked days of protests in Minnesota and cities around the United States, intensified by a video of the bloody aftermath Castile's girlfriend Diamond Reynolds streamed live on the internet from the car.

"This incident had nothing to do with the race of the driver," said attorney Thomas Kelly, who represents Officer Jeronimo Yanez, who fired the fatal shots. "It had everything to do with the presence of a gun."

Yanez and Officer Joseph Kauser of the St. Anthony Police Department stopped Castile's car in Falcon Heights, a suburb of St. Paul the department patrols. Both are on administrative leave, which is standard practice after an officer-involved shooting.

Reynolds said in the video officers told them Castile was stopped for a broken tail light and was getting his license and registration when he was shot. Authorities have not confirmed the reason for the stop.

"The use of deadly force here was necessitated by the actions of the driver of the vehicle," Kelly said.

Kelly said Yanez could see a weapon in the car. He declined to discuss details of the investigation.

Yanez, who is of Mexican descent, is cooperating fully with the state's investigation into the shooting, Kelly said.

"He's terribly saddened by the death," Kelly said. "He's sad for the family of the decedent and his loved ones."

Castile was killed a day after Louisiana police fatally shot a black man during an arrest and the day before an African-American man killed five police officers and wounded seven others during a protest march in Dallas.

Protesters have focused on the Minnesota governor's mansion in St. Paul since shortly after the shooting. More rallies and marches are planned for Saturday and Sunday.

Minnesota Governor Mark Dayton has said he did not believe Castile would have been shot dead had he been white, remarks which were criticized by state law enforcement groups.

Dayton also called for the U.S. Department of Justice to open its own investigation, but the department said on Thursday it would assist the state investigation as necessary.

Ramsey County Attorney John Choi has not decided whether to present the state findings to a grand jury or have his office determine if charges are warranted. Choi said on Friday law enforcement in Minnesota and nationwide must improve practices and procedures to prevent future such tragedies.

(Additional reporting by Kristoffer Tigue, editing by G Crosse)