Thousands of people commented on Facebook and Reddit, which linked to the post on Wednesday. Most of them praised Officer DePrimo, yet some suspected that the photograph had been staged. Many debated whether the officer’s actions were representative of police officers in general, or were just unusually exceptional.

Photo

“I still have a grudge against law enforcement everywhere,” wrote one commenter on the police Facebook page. “But my respects to that fine officer.”

Officer DePrimo, 25, who joined the department in 2010 and lives with his parents on Long Island , was shocked at the attention. He was not warned before the photo went online; the department had not learned which officer was in the picture until hours later.

The officer, normally assigned to the Sixth Precinct in the West Village, readily recalled the encounter. “It was freezing out and you could see the blisters on the man’s feet,” he said in an interview. “I had two pairs of socks and I was still cold.” They started talking; he found out the man’s shoe size: 12.

Newsletter Sign Up Continue reading the main story Please verify you're not a robot by clicking the box. Invalid email address. Please re-enter. You must select a newsletter to subscribe to. Sign Up You will receive emails containing news content , updates and promotions from The New York Times. You may opt-out at any time. You agree to receive occasional updates and special offers for The New York Times's products and services. Thank you for subscribing. An error has occurred. Please try again later. View all New York Times newsletters.

As the man walked slowly down Seventh Avenue on his heels, Officer DePrimo went into a Skechers shoe store at about 9:30 p.m. “We were just kind of shocked,” said Jose Cano, 28, a manager working at the store that night. “Most of us are New Yorkers and we just kind of pass by that kind of thing. Especially in this neighborhood.”

Mr. Cano volunteered to give the officer his employee discount to bring down the regular $100 price of the all-weather boots to a little more than $75. The officer has kept the receipt in his vest since then, he said, “to remind me that sometimes people have it worse.”

The photo was taken by Jennifer Foster, a civilian communications director for the Pinal County Sheriff’s Office in Arizona. She said the moment resonated for personal reasons: She remembered as a young girl seeing her father, a 32-year veteran of the Phoenix police force, buy food for a homeless man.

“He squatted down, just like this officer,” she said.

After returning from vacation, she described the picture in an e-mail to the New York Police Department, thinking of it as a sort of a compliment card. She never expected the picture to end up online — “I’m not on Facebook,” she said — but a department official e-mailed her and asked if she would send along the photo so it could be posted.

As for the man he helped, Officer DePrimo never got his name, and he could not be immediately located on Wednesday. “He was the most polite gentleman I had met,” the officer said, adding that the man’s face lit up at the sight of the boots. Officer DePrimo offered him a cup of coffee, but “as soon as the boots were on him, he went on his way, and I just went back to my post.”