NEW YORK – Federal inmate No. 84888-054 has saluted victims of the Sept. 11 terrorist attacks on his blog. He's also used it to lend his opposition to an Islamic center near ground zero, and to honor his father this past Father's Day.

The behind-bars blogging by convicted former New York City police commissioner Bernard Kerik is a bit of a mystery: Federal prisoners don't have Internet access, except for limited email correspondence that's apparently allowing someone to post for him.

In recent days, Kerik has had a more direct line of communication with the outside world — only this time, it's against his will, under oath and on a sore subject.

Prosecutors in the Bronx are forcing the one-time protege of former Mayor Rudolph Giuliani to testify as a government witness at the perjury trial of two contractor brothers who once remodeled his apartment. The same investigation resulted in Kerik pleading guilty in 2006 and 2009 to state and federal false statement and other charges stemming from renovations worth between $165,000 and $255,000.

"Fair to say you're not happy to be here?" a prosecutor asked Kerik on Monday.

"Yes, sir," responded Kerik.

Kerik, 57, who's serving time in a Maryland prison on the federal charges, has been temporarily transferred to a lower Manhattan lockup while appearing at the Bronx trial. He resumed testifying on Wednesday.

The appearance this week marked the first time Kerik had surfaced publicly since he surrendered for a four-year prison term in 2010. He looked much thinner than in his glory days as he was escorted in a prison jumpsuit and shackles into the courthouse — his head still clean-shaven but his signature mustache gone. He later was allowed to switch into a coat and tie for the trial.

It was the latest indignity for Kerik, whose downfall began in 2004, within days after the then-Bush White House nominated him to lead the Department of Homeland Security. At the time, he was billed as a no-nonsense patriot who, as leader of the nation's largest police department, helped restore order following 9/11.

But the nomination was greeted with a rash of news reports about stock-option windfalls, the shady apartment renovations and sexual liaisons with the publisher of his memoir at an apartment near ground zero that had been set aside for rescue workers.

His decision to withdraw his name for consideration for the cabinet post and his later indictment in 2007 embarrassed Giuliani, then a prospective presidential candidate.

Kerik returned to court this week to mostly face mundane questions about built-in cabinets, a rotunda with a marble entryway and other expensive renovations done to his Bronx apartment in 1999 — work prosecutors say was done by builders who sought his help winning city contracts.

His demeanor was dour as he repeatedly claimed ignorance about who covered the cost. He broke into a smile only once — while killing time by chatting with a female court officer as lawyers conferred with the judge at sidebar.

Kerik got testy when pressed by prosecutors if he had done anything wrong — "No, I didn't do anything wrong" — and teary when asked on cross-examination if he thought his guilty plea in the state case would end his legal woes.

In testimony on Wednesday, Kerik claimed that a prosecutor told him while negotiating the 2006 plea that gave him no jail time: "This is the end. ... You can get on with your life."

To his dismay, that didn't happen.

"There are times when I am filled with bitterness and anger at the system — and at myself — for being here," one of his blogs from prison reads. "I am constantly trying to make sense of it all, to seek out and find what good can come of this."