“It was running around like crazy and we didn’t want it to get hit by a car,” Mr. Osmani said.

Det. Sophia Mason said officers arrived on the scene at 8:36 a.m. and that the kangaroo, named Buster, was “taken into custody without incident” after 10 to 15 minutes. The animal was returned to his owner. Detective Mason said she could not confirm the owner’s name because he had not been arrested.

The detective said the kangaroo escaped from a fenced-in yard on Victory Boulevard and Travis Avenue, but that he did not leap over the fence. “Someone left the gate unlocked and he was able to get loose,” she said.

The house from which Buster escaped was registered to Giovanni Schirripa and two other people with the same last name. This was not the first time an exotic animal had escaped after Mr. Schirripa’s gate was left open. In 2012, a pony named Casper and a zebra named Razzi ambled out of his yard. At the time, Mr. Schirripa said that it was Casper’s third escape.

New York City law says it is illegal to keep a kangaroo or any other marsupial in the five boroughs, unless the animal is at a zoo, laboratory, circus or veterinary hospital.

Mr. Osmani said he had heard about the zebra. This was his first encounter with a kangaroo, he said, and he said Buster seemed to be having fun.