A former veteran Houston police officer was federally charged Tuesday in connection with the Jan. 6 riot at the U.S. Capitol after agents said they searched his phone and found deleted selfies taken inside the building.

Houston’s police chief said last week that the officer, Tam Pham, had resigned.

Pham initially told authorities during an interview Jan. 12 at his home in Richmond, Texas, that he traveled to Washington, D.C., for a business trip, according to an affidavit obtained Wednesday by NBC News. He said he briefly attended President Donald Trump’s rally after having learned about it on Facebook, but he denied following the crowd to the Capitol, FBI Special Agent Amie Stemen wrote in the affidavit.

IMAGE: Tam Dinh Pham
Former Houston police Officer Tam Pham.Obtained by KPRC

The search of his phone revealed otherwise. Agents found video of him inside the Capitol in his folder of deleted photos. Among the images were portraits of the Capitol Rotunda, a selfie inside the historic building and a photo of him posing with a statue of President Gerald R. Ford draped in a Trump 2020 flag.

The time stamp on the images and videos placed him inside the Capitol at the time of the siege, authorities said.

After investigators warned him that it was illegal to lie, Pham admitted that he joined rally attendees at the Capitol, according to the affidavit. He said he jumped barricades surrounding the building but had no intention to commit violence or vandalism, Stemen wrote.

Pham told investigators that he entered the Rotunda and remained for about 10 to 15 minutes to “look at the historical art on the walls,” according to the affidavit.

He was charged with one count of knowingly entering or remaining in any restricted building or grounds without lawful authority and one count of violent entry and disorderly conduct on Capitol grounds, records show.

Nicole Hochglaube, Pham’s attorney, said in an email Wednesday that Pham cooperated with the FBI and “prays for the success of the incoming Biden administration.”

“He is deeply saddened to be associated with the domestic terrorists who attacked our Capitol on January 6th, believes strongly in the rule of law, and that the election choosing President Biden was fair and free,” she said.

Download the NBC News app for breaking news and politics

Police Chief Art Acevedo announced Jan. 14 on Twitter that Pham, who had been with the department for 18 years, had resigned.

On Wednesday, Acevedo said in a statement on Twitter that he and the FBI immediately launched an investigation when they caught wind of Pham’s participation.

He said the police department was auditing the arrests made by the former officer to ensure that there were “no irregularities.”

At a cadet welcome training event Tuesday, he reprimanded Pham and other police officers across the country who participated in the mob.

“If anyone in this room right now believes that anyone needed to be in the Capitol building, you need to check out,” Acevedo said. “You will not survive in this department with that mindset.”

He said that the department was looking into other officers who stormed the Capitol and that no other cases had been found.

Pham was among dozens of pro-Trump rioters whom federal investigators were searching for after the riot, which left five people dead, including a police officer.