Photo

NEWTON, Iowa – Bernie Sanders recalled his days on picket lines. Hillary Rodham Clinton spoke out against privatizing government jobs.

In dueling town-hall meetings this weekend, Mrs. Clinton and Mr. Sanders courted the endorsement of the American Federation of State, County and Municipal Employees.

Their appeals offered a contrast between the two candidates, who share long histories with labor, but differ in tone and ideology.

Mrs. Clinton has cultivated relationships with labor leaders, but also faces pressure from them to fully embrace their economic agenda, especially on issues like trade.

In her town-hall meeting on Sunday, Mrs. Clinton vowed to fight what she called “an insidious, persistent effort to destroy the American labor movement, starting with the public sector unions.” She singled out Wisconsin, whose Republican governor, Scott Walker, is also running for president.

“In fact, all the Republicans who are running for president are in the same mind-set,” she said.

Mrs. Clinton presented herself as a proven bulwark against such efforts and also promised to crack down on wage theft.

At his appearance before the group on Saturday, Mr. Sanders said he possessed “maybe the strongest pro-union voting record over the last 25 years than any member of Congress.”

He portrayed himself as ascendant, observing that only months ago he had been described as a “fringe guy,” and proudly citing the sizes of the crowds he has drawn while campaigning.

Mr. Sanders has been a vocal opponent of the Trans-Pacific Partnership, a trade deal that has been fought by unions. He has also proposed raising the federal minimum wage to $15 an hour.

Mr. Sanders, a socialist, spoke to union members as if they were kindred spirits.

“You’re not another special interest to me,” he said. “I’m not going to leave here to go out to meet with the bankers or corporate America. You are my family. This is what I do.”

The town-hall meetings were closed to the news media but were streamed online for union members, and The New York Times obtained access.