It was a simple gesture captured in a photograph: Malcolm Turnbull, the prime minister of Australia, leaning over and placing money in the paper cup of a homeless man in Melbourne this week.

The contrasts in that moment of charity were stark. There were the buffed shoes and suit of a man of power, next to the ragged clothes of a man sitting on a sidewalk. The prime minister’s cleanshaven face was inches from the man’s scraggly hair and furrowed brow. In one of Mr. Turnbull’s hands, a wad of bank notes; in the other, the single note he was depositing in the cup, an Australian 5-dollar bill (worth about $3.80).

The political overtones were also hard to miss: Mr. Turnbull, who led his conservative coalition to an election victory just last month, was on his way to deliver a major speech at the Committee for Economic Development of Australia.

By the end of the week, those few dollars had bought Mr. Turnbull a barrage of attention and had spurred a debate about how best to help homeless people — a problem that has bedeviled major cities around the world, including New York, Los Angeles and San Francisco.