Nearly a dozen detectives have been assigned to protect ex-Police Commissioner Ray Kelly since he left office Dec. 31.

The security detail is composed of first- and second-grade detectives, police sources say, at a cost to New Yorkers of $1 million to $1.5 million a year.

There's a silver lining: Kelly has fewer detectives on his 10-person security detail than did Rudy Giuliani when he left as mayor at the end of 2001. Giuliani's security entourage -- which lasted a year and a half and cost about $1 million a year -- protected him; his ex-wife, Donna Hanover; their children, Andrew and Caroline; his mother, Helen; and his then-girlfriend, Judith Nathan, whom Rudy subsequently married.

Giuliani's protection posse even accompanied him to Mexico City, where his firm, Giuliani Partners, had a $4.3-million consulting contract to reduce crime. The ex-mayor also provided his favorite police commissioner, Howard Safir, with a security detail when Safir left office in 2000.

Safir succeeded Bill Bratton after Bratton's first tour as commissioner. Giuliani wanted to make Safir seem better than Bratton, whom Giuliani dismissed with no credible explanation.

At the time, Giuliani said Safir received protection because of threats on his life. Top police officials said then that there were no credible threats. Safir's detail lasted 16 months and consisted of more than a dozen detectives. It turned out, they primarily delivered Safir's dry cleaning.

Contrary to what mayors say, Intelligence Division chiefs say police protection has less to do with security than with politics.

"With public officials, it comes with the territory," said a former Intelligence Division chief who asked to remain anonymous. "If they never had a threat, they still get it [protection]."

Another intelligence chief, Danny Oates, now chief of police in Aurora, Colo., said in 2002 he did not recall doing a formal threat assessment for Safir or any other city employee provided with a detail. "The process wasn't formalized," he said then.

Until Michael Bloomberg became mayor in 2002, police sources said, the only public official in recent years to receive credible threats warranting protection was neither a mayor nor a police commissioner but then-State Supreme Court Justice Leslie Crocker Snyder. She was threatened by a drug gang over whose trial she presided.

When he became commissioner, Kelly provided a one-detective detail for longtime friend Guy Molinari, then-former Staten Island borough president. In 1993, in Kelly's first tour as police commissioner, he had sought Molinari's help to arrange an interview with Giuliani to keep his job.

Large-size details like those providing security for Giuliani, Safir or Kelly appear to be a recent phenomenon.

Edward Koch had a six-member detail after leaving as mayor, but it was withdrawn after six months and some $180,000 in public expense. The detail for David Dinkins consisted of a single detective, who became the former mayor's driver.

When Giuliani fired Kelly in 1994, Kelly got a detective who served as his driver for a few months. When Giuliani forced out Bratton in 1996, Bratton got nothing.

In 2002, when Bloomberg became mayor and Giuliani was seen as the hero of 9/11, Bloomberg ordered then-Commissioner Kelly to provide the ex-mayor with a permanent police detail.

"The mayor remains one of the highest-profile people in the country and with that comes security concerns . . . ," Michael O'Looney, Kelly's spokesman at the time, said of Giuliani.

The decision to provide security is made by the Intelligence Division's Threat Assessment Unit. How the unit comes to its decisions is anybody's guess.

The department would not specify or enumerate the threats against Kelly, but an official said the most recent threats related less to terrorism and more to the NYPD's controversial stop-and-frisk program.

Kelly -- who has a second home in Deerfield Beach, Fla. -- made two speeches in Sarasota. It's unclear whether his detail accompanied him.