Mr. Kelly said he had notified the Mayor of his decision but did not consult him in advance. Mr. Dinkins had supported Mr. Kelly and former Commissioner Lee P. Brown in their opposition to the 9-millimeter gun when members of the State Senate sought to force the department to make the change. The pilot program, which would ultimately have given 1,000 9-millimeter guns to patrol officers, was adopted as a compromise to hold off the Senate.

The Mayor had said in the past that he was troubled that the semiautomatic gun could be too dangerous, but City Hall officials said yesterday that the Mayor has never held a position on what kind of gun police officers should carry, only a stance against micromanagement by officials outside the city.

"I have always believed that the choice of which sort of weapon our women and men in blue should carry as a sidearm was a matter solely within the domain of police experts and professionals," the Mayor said in a statement. "In this city, that expert is the Police Commissioner."

But when the New York City transit police won permission from the independent Metropolitan Transportation Authority board to make semiautomatic pistols standard in 1990, Albert Scardino, Mayor Dinkins's spokesman at the time, said: "We thought it was a bad idea when it was first proposed, and we think it's a bad idea now. We believe it will jeopardize the safety not only of the people in the subway but the officers themselves."

Rudolph W. Giuliani, the Republican-Liberal candidate for mayor, accused Mr. Dinkins yesterday of changing his position on the use of the guns to curry favor with police officers.

"For once I'm glad about the Mayor's flip-flopping," Mr. Giuliani said. "David Dinkins has abandoned what for him was a position of principle for the sake of political expediency." Mr. Kelly said that he had not discussed the change with Phil Caruso, president of the P.B.A., who in a statement yesterday commended the decision.

The entire police force, which will number about 30,500 in the fall, will be able to change over to the 9-millimeter weapon, Mr. Kelly said. Many officers will probably switch, he said, but others will be reluctant to spend roughly $400 for the new weapon, and many veterans of the force will resist the change. Mr. Kelly said that he expects it to be more than a decade before the entire force carries the 9-millimeter gun. He said he would continue to carry a .38 inside his sock.