SAN FRANCISCO (AP) — The man accused of bludgeoning former House Speaker Nancy Pelosi’s husband with a hammer was caught up in conspiracies when he broke into her San Francisco home last year, his defense attorney said as his trial opened Thursday.

The attack on then-82-year-old Paul Pelosi in the early hours of Oct. 28, 2022, sent shockwaves through the political world just days before last year’s midterm elections.

Defense attorney Jodi Linker said Thursday she won’t dispute that her client David DePape attacked Paul Pelosi, an encounter caught on police body camera video. Instead, she will argue that he believed “with every ounce of his being” that he was taking action to stop government corruption and the abuse of children by politicians and actors.

“This is not a ‘whodunit.’ But what the government fails to acknowledge is the ‘whydunit,’ and the why matters in this case,” she said.

DePape pleaded not guilty to attempted kidnapping of a federal official and assault on the immediate family member of a federal official with intent to retaliate against the official for performance of their duties. The crux of Linker’s argument is that DePape is not guilty of the charges because he was not after Nancy Pelosi to try to stop her from engaging in her official duties.

“These beliefs matter because both charges require that the government prove that Mr. DePape acted because of her performance of her official duties as a member of Congress,” Linker said. She said DePape’s beliefs are “wholly unrelated to Nancy Pelosi’s official duties.”

Federal prosecutor Laura Vartain Horn told jurors that DePape started planning the attack in August and that the evidence and FBI testimony will show he researched his targets online, collecting phone numbers and addresses, even paying for a public records service to find information about Nancy Pelosi and others.

During her opening statement, Vartain Horn showed a photo of Paul Pelosi lying in a pool of blood. She also played a call DePape made to a television station repeating conspiracy theories.

“The evidence in this case is going show that when the defendant used this hammer to break into the Pelosi’s home he intended to kidnap Nancy Pelosi,” Vartain Horn said, holding a hammer inside a plastic evidence bag.

Prosecutors showed body camera video of DePape admitting to the attack while speaking to police and paramedics outside the Pelosis’ home.

“There is no denying what I did. Cops watched me do it,” he said.

Paul Pelosi is expected to testify next week.

DePape posted rants on a blog and an online forum about aliens, communists, religious minorities, and global elites. He questioned the results of the 2020 election and echoed the baseless, right-wing QAnon conspiracy theory that claims the U.S. government is run by a cabal of devil-worshipping pedophiles. The websites were taken down shortly after his arrest.

If convicted, he faces life in prison. He also has pleaded not guilty to charges in state court of attempted murder, assault with a deadly weapon, elder abuse, residential burglary and other felonies. A state trial has not been scheduled.

In the courtroom Thursday were Christine Pelosi, one of the Pelosis’ daughters, as well as Gypsy Taub, DePape’s ex-girlfriend, and Taub’s and DePape’s two sons. Taub called DePape’s name softly and blew a kiss, and he smiled and waved in return.

A Canadian citizen, DePape moved to the United States more than 20 years ago after falling in love with Taub, a Berkeley pro-nudity activist well-known in the Bay Area, his stepfather, Gene DePape said. In recent years, David DePape had been homeless and struggling with drug abuse and mental illness, Taub told local media.

Federal prosecutors say DePape smashed his shoulder through a glass panel on a door in the back of the Pelosis’ Pacific Heights mansion and confronted a sleeping Paul Pelosi, who was wearing boxer shorts and a pajama top.

“Where’s Nancy? Where’s Nancy?” DePape asked, standing over Paul Pelosi around 2 a.m. holding a hammer and zip ties, according to court records. Nancy Pelosi was in Washington and under the protection of her security detail, which does not extend to family members.

Paul Pelosi called 911 and two police officers showed up and witnessed DePape strike him in the head with a hammer, knocking him unconscious, court records showed.

Nancy Pelosi’s husband of 60 years later underwent surgery to repair a skull fracture and injuries to his right arm and hands.

After his arrest, DePape, 43, allegedly told a San Francisco detective that he wanted to hold Nancy Pelosi hostage. He said that if she told him the truth, he would let her go and if she lied, he was going to “break her kneecaps” to show other members of Congress there were “consequences to actions,” according to prosecutors.

DePape, who lived in a garage in the Bay Area city of Richmond and had been doing odd carpentry jobs to support himself, allegedly told authorities he had other targets, including a women’s and queer studies professor, California Gov. Gavin Newsom, actor Tom Hanks and President Joe Biden’s son Hunter.

The professor, who is also expected to testify next week, was DePape’s main target and DePape went to the Pelosis’ home to have Nancy Pelosi “lure her out,” Linker said.

San Francisco Police Acting Lt. O’Connor, who helped process the crime scene, testified she collected a sleeping bag and two backpacks from the Pelosis’ patio that DePape allegedly brought with him. Items in the backpacks included a sledgehammer, zip ties, gloves, duct tape, cash, a Canadian passport, a Canadian birth certificate, men’s clothes, a video game console, and two inflatable, multicolor unicorn costumes, she said. ___ This story has been corrected to show that defense attorney Jodi Linker said her client believed “with every ounce of his being,” not “with every ounce of his body.”