He sounds like Cheech Marin, raps like Jay Z, and preaches love like Gandhi. Hamza Perez is not your average Muslim. Mr. Perez, the Imam of the Light of the Age Mosque located on Pittsburgh’s North Side, also serves as the Youth Director at the Islamic Center of Pittsburgh, where he runs YA-NE, Youth Alliance for Networking and Empowerment program.

If the adage is true that God writes straight with crooked lines, then God’s pen was all over the page while bringing Mr. Perez to Islam. Hamza Perez was born Jason Perez in Brooklyn, New York, an American of Puerto Rican descent. His mother was Catholic, and he attended Catholic schools in his early years. When his parents divorced, his family moved back to Puerto Rico, and then they moved back to the United States to a housing project in Massachusetts. The family moved to Puerto Rico and back to Massachusetts several times. Members of his family were involved in gangs like the Turban Saints, a Brooklyn street gang, and in dealing drugs.

When he was 14 and living in Puerto Rico, he began to smoke marijuana laced with heroin. When he returned to the U.S., he became a drug dealer at the age of 16 in his housing project and acquired so much money, that he moved into his own apartment when he was 17. By the time he was 18, he was so successful dealing drugs that he had set up his own confederation of dealers.

Although Mr. Perez had lots of money and women, he was unhappy. “Human beings, we’re hollow. We’re hollow beings. We’re always looking to be fulfilled. Either by being recognized through our statuses on Facebook, through our Tweets. Trying to be liked by people. Trying to seek attention from people. We’re always trying to fill this emptiness inside. I was searching for it at the age of 18,” said Mr. Perez in a talk at Pittsburgh’s Creative Mornings networking group.

While sharing an apartment with a friend who had murdered someone, this friend disappeared. When the friend later reappeared, he revealed that he had converted to Islam. When he introduced Mr. Perez to Islam, that void in his life was filled. Fifty-five others living in their housing project also converted.

Adhering to this new-found life was not easy for him or his family. He had to give up the women and the drugs cold turkey, and at first his conversion was confusing for his Catholic mother, but seeing her son leave behind the street life gave her reassurance.

He changed his first name to Hamza and began to use his talent for rap to create Muslim-inspired hip hop music. He then moved to Pittsburgh to establish a mosque, but unlike other Islamic communities, this mosque is centered on converts to Islam. Divorced and with two children from a previous marriage, it was here that Mr. Perez met his second wife Rafiah. But all was not easy for Mr. Perez and his new community. In 2006, the F.B.I. raided the mosque and Mr. Perez is still not sure why.

In 2009, the documentary “The New Muslim Cool” was released by PBS and chronicled Mr. Perez’s journey from the mean streets to the mosque in Pittsburgh. Mr. Perez stresses that the Muslim experience for Americans, especially Latino Muslims is a much different one than that of foreign-born Muslims. He laments the fact that the news media filters everything through the eyes of immigrant Muslims and notes that when Muslims are interviewed by the media, they always consult immigrant Muslims and not African-American Muslims who were brought here as slaves.

In 2010, Mr. Perez was named one of the top 500 most influential Muslims in the world by The Royal Islamic Strategic Studies Centre for his work with youth. He is also involved in reaching out to those who are in prison.