Three years ago, Gary P. Delagnes, the president of the San Francisco Police Officers Association, made a bullish prediction after successfully negotiating a lucrative four-year contract: After a scheduled 4 percent pay raise phased in on July 1, 2010, Mr. Delagnes wrote in a note to the officers, the force would most likely fulfill a 20-year mission to become the “highest paid major police department in the country.”

Now, his prediction may be coming true, but at the worst possible time. As it nears its gilded goal, the union may be simultaneously alienating itself from its traditional rooting sections on the street and in City Hall. The raise is set to take effect just as city government is cutting deeply across every department in an effort to bridge a record $522 million budget gap.

The city has asked the police union to forgo the raise, but the union has refused. Union officials said that Mayor Gavin Newsom had warned them that he may take the unprecedented step of laying off 180 of the force’s 2,374 uniformed officers to save $17 million. A spokesman for the mayor’s office said that the city was seeking those savings by any means possible and that it did not rule out layoffs.

“When I sit down with my constituency,” said Supervisor David Campos, who was on the police commission before running for district office, “the feeling I get is they want the police, but they don’t want the police being the best compensated in the country when we’re shutting down gyms and pools.”