RIVERSIDE, Calif. — The regulars did not take it seriously when Enrique Marquez mused about terrorism at Morgan’s Tavern, a dank dive bar where Mr. Marquez hauled ice, cleaned bathrooms and checked IDs at the door. After a few drinks, he would just start talking — about his money woes, trying to lose weight, wanting to join the Navy. News reports about terrorism were just fodder for more bar talk.

“He would say stuff like: ‘There’s so much going on. There’s so many sleeper cells, so many people just waiting. When it happens, it’s going to be big. Watch,’ ” said Nick Rodriguez, a frequent patron who had known Mr. Marquez on and off for the past two years. “We took it as a joke. When you look at the kid and talk to him, no one would take him seriously about that.”

But nine days after a husband and wife slaughtered 14 people in a terrorist attack at a county health department meeting, Mr. Marquez, 24, a childhood friend of the husband, Syed Rizwan Farook, has become a crucial if unlikely figure in the investigation of the attack — which was just the kind he discussed when terrorism news reports flashed onto the tavern’s television.

While he initially checked himself into a mental health facility after the Dec. 2 massacre in San Bernardino, he has been speaking for hours with federal investigators after waiving his right to remain silent and not incriminate himself, officials say.