By Nate Raymond

NEW YORK (Reuters) - An armed, retired New York City police officer was taken into custody outside Trump Tower and charged for resisting U.S. Secret Service agents while they were protecting Republican presidential candidate Donald Trump, authorities said on Wednesday.

Anthony Shark, 54, was arrested on Tuesday night after refusing instructions to leave a street outside the building that agents had closed off while protecting Trump, according to a criminal complaint filed in Manhattan federal court.

According to the complaint, Shark, who was carrying a firearm in a holster, tried to push through a human wall that agents formed to prevent him from moving forward, and grabbed at agents as they sought to restrain him. The complaint was made public on Wednesday.

The Secret Service said in a statement the arrest took place just prior Trump's motorcade arriving and that agents later determined Shark had a lawful gun permit.

Shark expressed no "direction of interest" toward Trump or anyone else under Secret Service protection, the Secret Service said.

Annalisa Miron, a court-appointed lawyer for Shark, told reporters after a court hearing on Wednesday that the case was "just another example of Donald Trump ruining another person's life."

At the hearing, Miron said her client posed no danger and works near Trump Tower as a security guard at luxury jeweler Harry Winston's headquarters in Midtown Manhattan.

Shark was released after the court hearing and ordered by U.S. Magistrate Judge Barbara Moses to stay out of Trump Tower.

"Can I trust you to stay away from the Secret Service?" she said.

"Yes," Shark replied.

Shark faces one count of assaulting and resisting a Secret Service agent. He faces a maximum of eight years in prison.

(Reporting by Nate Raymond in New York, editing by G Crosse)