TROY — Concerns for the safety of undercover officers and the public led New York City detectives to arrest a veteran Troy police sergeant on sex charges before a planned meeting with someone he thought was a 14-year-old girl, authorities said.

Sgt. Patrick Rosney of East Greenbush was arrested Friday morning when he arrived for work at police headquarters in a sting operation involving a detective posing as the teen. The 53-year-old police officer was driven to Queens to be arraigned on charges of attempted first-degree dissemination of indecent material to minors, a felony, and attempted endangering the welfare of a child, a misdemeanor.

Rosney, a 26-year veteran of the Troy police force, was released Saturday on $30,000 bail and must return to Queens County Court on June 15. His service weapon and credentials were taken from him.

It is common in such stings for investigators to make the arrest after setting up a meeting with the suspect in a public place.

In this case, detectives had a suspect whom they feared might be legally armed, authorities said.

"NYPD did not want to possibly compromise the safety of the undercover officers and the public, so it was decided to notify the Troy Police Department to make the arrest while he was at work," said Helen Peterson, deputy director of communications for Queens County District Attorney Richard Brown. "It was a safety issue."

Brown's office on Monday released copies of the deposition of Detective Sean Ryan of the NYPD Vice Enforcement Division, who pretended to be the 14-year-old girl and allegedly chatted with Rosney via AOL and Yahoo instant messaging.

In his deposition, Ryan stated that at 3:35 p.m. on May 15, he received a message from an email address that he later traced to Rosney at his East Greenbush home.

"The defendant asked what I looked like," Ryan stated.

Ryan responded that he was a 14-year-old girl who lived in Queens, and "Within 15 minutes of initiating the instant message conversation, (the defendant) wrote: 'Ever been with an older guy? LOL ... What have you done with guys.' The defendant wrote that he wanted to meet to have sex."

The Internet conversations, most of them too lurid for newspaper publication, allegedly continued on May 17 when, according to Ryan, Rosney messaged, "wanna look at my cam."

Five hours later, Ryan stated, he received an image of Rosney.

"I was able to see his face as well as his penis," Ryan wrote. "He was wearing a 'Crabby Dicks' T-shirt (a Delaware seafood restaurant) and blue pajama pants."

The sexually explicit comments continued, and Rosney then set up a meeting for Tuesday, June 5, according to records. Police have not revealed where that meeting was to take place.

According to the deposition, Rosney's messages were sent from his private computer.

Rosney was suspended without pay for 30 days. His base pay is $68,040, and in 2011 he earned $89,167, including overtime, according to payroll records.

Chief John Tedesco said the department's Internal Affairs Unit will investigate the accusations to determine if local criminal charges should be filed and what departmental charges Rosney could face.

Rosney's attorney, Daniel Russo of Mineola, Nassau County, could not be reached for comment.

bgardinier@timesunion.com • 518-454-5696 • @BobGardinier