Back in Pakistan, he did a stint in advertising before becoming a journalist, a producer of a political satirical television show and then one of the country’s first stand-up comedians in English.

His routine there included jokes about such things as Pakistan’s uneasy relationship with the United States and suicide bombings. But Mr. Shah, a nonpracticing Shiite, soon learned that religion was off limits when a member of the audience told him to stop midway through a performance.

IT was a world away from Northam, a town of 7,000 people in the Wheat Belt of Western Australia that is also home to a detention center for 600 asylum seekers.

Northam’s social life revolves around the pub or the high school parking lot, where residents gather next to their pickup trucks for beer-fueled weekend afternoons watching the local Australian-rules football team.

Shortly after Mr. Shah arrived in the town, a local who saw him at the Woolworths grocery store thought he was a refugee on the loose from the detention center. That and other slices of his odd-couple relationship with his new home were to become grist for his comedy routines.

But not right away. He first did some freelancing as a graphic designer and a radio commentator, but mostly he became a stay-at-home father, minding his daughter while his wife went to work. He got depressed. “I was definitely worried about him,” Ms. Alvi said over a burger lunch at Fitzgeralds Hotel in Northam. “There were a lot of days coming home and finding him eating straight from a jar of Nutella.”