A San Francisco police officer who has been on suspension for three years for sending racist and homophobic text messages was charged Wednesday with robbing a bank.

Rain Daugherty was identified by a bank teller and surveillance video, and later by fellow officers, as the man who entered the East West Bank on Irving Street in San Francisco’s Sunset District on Nov. 29, handed a note to a teller demanding $50 and $100 bills, and fled with about $9,050 in cash, an FBI agent said in a court filing.

Federal prosecutors said Daugherty, 44, was arrested Tuesday and charged Wednesday with bank robbery, punishable by up to 20 years in prison. He appeared at a court hearing later in the day, represented by a federal public defender, and remains in custody.

Daugherty is one of a group of officers whose text messages were discovered by federal agents in 2012 during a corruption investigation of Sgt. Ian Furminger, then a veteran plainclothes officer.

The texts disparaged racial minorities, women and gay people. One proclaimed “White power”; another called African Americans “monkeys”; and Furminger, according to a court filing, wrote that “cross-burning lowers blood pressure!”

Furminger and another officer, Edmond Robles, were convicted in 2014 of unrelated charges of stealing money that police had found while searching drug dealers and their homes. The Police Department learned about the text messages from federal prosecutors in December 2012 but did not disclose them publicly until March 2015, leading then-Police Chief Greg Suhr to announce that he would fire nine of the officers, including Daugherty, and take disciplinary action against others.

Daugherty then filed papers saying he was”deeply ashamed” of writing the texts, but arguing that the legal deadline for disciplinary action had expired a year after the department discovered the messages. A Superior Court judge agreed but was overruled in May by a state appeals court, which said the criminal investigation of Furminger had suspended the one-year deadline until the December 2014 jury verdict in his case.

The state Supreme Court denied review of the officers’ appeal in September and allowed the disciplinary proceedings. Daugherty was suspended from his job in 2015, according to court documents. He is currently on unpaid status, according to the Police Department.

In Wednesday’s court filing, FBI agent Gary Grzymala wrote that the robber entered the bank on Irving Street shortly after 2 p.m. on Nov. 29 and handed a note to the teller demanding $50 and $100 bills. The teller said the man told her something like, “Calm down, just do it,” wrote Grzymala, who spoke to the witnesses and police at the scene.

The teller grabbed a stack of cash from a drawer and gave it to the man, who fled while a second teller pressed an alarm button, Grzymala said.

Surveillance camera footage showed the robber to be a white man in his 40s with a light beard, wearing a plaid button-down shirt and a baseball cap, similar to the description given by both tellers, Grzymala said. When photos of the man were sent to the Police Department, he said, Daugherty was identified by two Internal Affairs officers — one of whom had worked with him at Mission Station, the other an investigator in the disciplinary case.

Later, at a photo lineup, the agent said, one of the tellers was unable to identify anyone as the robber, but the other teller identified Daugherty.

Bob Egelko is a San Francisco Chronicle staff writer. Email: begelko@sfchronicle.com

Twitter: @BobEgelko