A man in Florida who shot two of his roommates dead gave an unusual defense, the authorities say: they were neo-Nazis who had disrespected his recent conversion to Islam.

The arrest of the gunman, who said he had also been a neo-Nazi before becoming Muslim, led to the discovery that a fourth roommate had been stockpiling materials that could be used to create a bomb, according to a federal criminal complaint. That roommate, a member of the Florida National Guard, kept a picture of Timothy McVeigh, the Oklahoma City bomber, on his dresser, the authorities said.

Both men are now in custody. The accused gunman, Devon Arthurs, 18, has been charged with two counts of murder, and his surviving roommate, Brandon Russell, 21, has been charged with two counts related to the explosive material and devices.

Authorities first became involved on Friday evening when Mr. Arthurs took three people hostage at gunpoint at a head shop in Tampa, according to an affidavit from the Tampa Police. He was arrested soon after.