SAN JOSE — A man who terrorized downtown San Jose in early January by setting more than a dozen fires and causing millions in damage pleaded guilty Monday to multiple counts of arson and agreed to serve 40 years to life in prison for his crimes.

Patrick Brennan, a 49-year-old ex-felon, pleaded guilty to the 10 counts of arson, three counts of attempted arson and special allegations filed against him, said Santa Clara County deputy district attorney Bud Porter. The Probation Department will report back on the case in time for a hearing set for Feb. 13, when Brennan will be formally sentenced, Porter added.

“I’m not going to say we’re thrilled. We’re satisfied,” Porter said. “It’s the right result. He should not get out. He’s a dangerous person.”

Under the plea bargain, which was agreed to by Brennan and his public defender, Malorie Street, Brennan will serve at least 85 percent, or nearly 13 years, of a 15-year sentence in the arson case and then serve a minimum of 25 additional years before he could file for parole from the life sentence, Porter said. He would be 85 years old before he had the option for a parole hearing, according to Porter.

“He had a lot of regret,” Street said. “He fully cooperated with law enforcement. We’re happy we’re able to resolve it.”

Brennan was arrested Jan. 17 and then led police to the exact locations where he admitted he set 13 fires between Jan. 8 and Jan. 12 in an area between Santa Clara and William streets and 17th and 33rd streets. The fires damaged or destroyed homes and other structures, including six that were occupied and a 125,000-square-foot warehouse on North 28th and Julian streets consumed by a five-alarm blaze with $5 million in damage, according to police.

Before the January fires, Brennan had been placed both on a registry of people convicted of arson who must report to police and on California’s Megan’s Law list of sexual offenders, according to prosecutors.

He previously served time for setting fires in the Grand Canyon and for setting wildfires in Gilroy, for which he served time in prison as well as a probation term, Porter said.

Brennan later served nearly a decade in prison for a sexual assault conviction, which was a third strike. He was paroled in 2012, according to Porter.

Bay City News contributed to this report. Contact Katie Nelson at 408-920-5006 and follow her at Twitter.com/katienelson210.