White Plains, New York (CNN) -- Former New York Police Commissioner Bernard Kerik on Thursday pleaded guilty to charges of lying to Bush administration officials who vetted his unsuccessful 2004 nomination to be homeland security secretary.



Kerik admitted to eight counts as part of a plea agreement with federal prosecutors, who are recommending a 27- to 33-month prison term. U.S. District Judge Stephen Robinson set Kerik's sentencing for February 18.



In court papers, prosecutors said Kerik denied to a White House official that there was "any possible concern" about his relationships with the contractors involved in renovations to his apartment or that he had any financial dealings with prospective city contractors.



Kerik, 54, had been scheduled to go to trial next week on a variety of corruption charges, including allegations that he received and concealed benefits of about $255,000 in renovations to his Riverdale, New York, apartment from a company seeking to do business with the city of New York. He pleaded guilty to that charge and several tax-related counts during Thursday morning's hearing.



Robinson said he would take into account Kerik's life and career, which he said "included good" as well as wrongdoing. Kerik put his head in his hands at that point.



Kerik has spent the past two weeks in jail after a judge revoked his bail. According to court papers released in late October, he violated the terms of his bail by leaking confidential evidence about his case to a lawyer who published the material online.



Kerik served as New York police commissioner from 1998 to 2002 -- a tenure that included the September 11, 2001, terrorist attack that destroyed the World Trade Center and killed more than 2,700 people. He spent a brief stint in Iraq training the country's police force after the U.S. invasion in 2003, and was nominated by President George W. Bush for the post of homeland security secretary in 2004. However, he withdrew from consideration after allegations surfaced that he employed a nanny whose immigration status was murky.



In 2006, Kerik pleaded guilty to accepting tens of thousands of dollars worth of gifts while he worked as city corrections commissioner, but under a plea agreement he paid $221,000 in fines and avoided jail time. His admission dogged the 2008 presidential campaign of his longtime patron, former New York Mayor Rudy Giuliani, who said his endorsement of Kerik had been "a mistake."



Kerik made an unsuccessful appeal for clemency to Bush in late 2008, according to court papers released in October.



CNN's Mary Snow and Julian Cummings contributed to this report.
How long of sentence did the prosecutors recommend? When will the NYPD commissioner be sentenced? Who is Bernard Kerik? What was Kerik accused of?
27- to 33-month February 18. Former New York Police Commissioner lying to Bush administration officials
question: How long of sentence did the prosecutors recommend?, answer: 27- to 33-month | question: When will the NYPD commissioner be sentenced?, answer: February 18. | question: Who is Bernard Kerik?, answer: Former New York Police Commissioner | question: What was Kerik accused of?, answer: lying to Bush administration officials