Newsom testified against one of his own -- a former employee accused of hijacking the city's computer network, costing the city millions of dollars and weeks of worry.
"I'm glad to have an opportunity to tell the jurors about my experience and interaction with Mr. Childs; there was significant harm done," Newsom said.
Terry Childs was once a top engineer for the San Francisco Department of Technology. Now the 45-year-old is on trial, being held on $5 million bail, accused of hijacking the city's computer network in July 2008.
Prosecutors say Childs refused to give his bosses a secret password, in effect locking the city out of its own system for 12 days.
The mayor says he took Childs up on his offer to meet in jail with "the singular purpose of walking out with the password."
In court Tuesday, Newsom recalled trying to reach his former city employee on a human level, telling him his wedding was just days away and that as mayor he wanted to be able to leave the city without worrying about a complete technology collapse.
Newsom testified that a lengthy code of 24 numbers, 3 letters and one character was what Childs wrote down, apparently from memory, as they talked in the county jail. But the password did not work until more instructions were given.
"I was appreciative but make no mistake, that doesn't by any stretch mean he should be excused from the consequences of his actions," Newsom said.
Lawyers in the case are under a gag order, unable to discuss the case. During Newsom's cross examination, Childs' attorney pointed out that the city's system never failed despite all the concern.
But outside the courtroom, the mayor said he still has fears right now of a booby trap.
"It's somewhat Kafkaesque; there's always a remaining concern that we're still in the process, to me, we're by no means out of the woods," Newsom said.
The defense has yet to lay out its case. The trial, which began in December, may not end until late next month.