When he got home, the teenager had his hood up and went straight to his room, Mr. Mohtaseb said. His mother, sensing something was wrong, checked on him and saw the dark bruises around his eye. She immediately called Mr. Mohtaseb at the Partnership for the Advancement of New Americans, an advocacy group for refugees, and began filing a police report within two hours of the attack.

Image Injuries sustained by the teenager, who has not ridden the trolley since the attack. Credit... via Partnership for the Advancement of New Americans

Investigators found video evidence from the trolley that supported the boy’s account.

The Port of San Diego Harbor Police Department arrested Mr. Vergara one week after the attack for an unrelated misdemeanor narcotics charge, the police said. The authorities recognized him and transferred him to the San Diego Police Department, where he was booked into jail, the police said.

The teenager was emotionally traumatized and has not been on the trolley since the attack, Mr. Mohtaseb said, adding that the teenager is being home schooled until the end of the semester.

The teenager released a public statement a week after the attack, saying his family “came to this country under the belief that we would have civil rights and liberties and safety.”

“There are many people who don’t know Arabs and Muslims and believe that we are violent,” he said. “However, I want to show that this is not true. When I was attacked, I could have fought back. However, I chose to stay calm and not fight back.”

The teenager said that when his family first moved to the United States, his brother experienced a hate crime that the family did not report. He said he did not want to stay quiet this time.

“I urge others who are victims of such attacks to speak up and not stay silent,” he added.

The Partnership for the Advancement of New Americans, which was founded five years ago, works to resettle refugee families in the area, according to Ramla Sahid, the group’s executive director.