Jonathan Tran. (CBS, Reuters)

A California man who breached the White House’s secure perimeter and roamed free for nearly 17 minutes in March pleaded guilty Thursday to one count of knowingly entering and remaining on restricted grounds.

Jonathan T. Tran, 27, of Milpitas, faces sentencing Sept. 25 before U.S. District Judge James E. Boasberg in the March 10 incident that led to renewed criticism of the U.S. Secret Service and further restrictions on public access to areas around the presidential residence.

In April, the Secret Service imposed tighter security measures, including prohibiting access to sidewalks, roadways and other areas along the White House’s southern fence line between West Executive Avenue and East Executive Avenue.

Tran was detected crossing a five-foot outer fence near East Executive Avenue and the Treasury Department complex at 11:21 p.m. but was not arrested until 11:38 p.m. near the South Portico entrance, the agency said. He was carrying Mace.

To approach the mansion, Tran scaled two additional barriers, according to the Secret Service account — an eight-foot vehicle gate, then a 3½-foot fence near the southeast corner of the East Wing.

“Restricting public access to the fence line will not only serve to lessen the possibility of individuals illegally accessing the White House grounds, but will also create a clear visual break to enable Secret Service officers to identify and respond to potential hazards including individuals attempting to scale the fence,” the agency said in a statement at the time.

In a plea agreement for the misdemeanor, both sides agreed to recommend that Tran be barred from returning to the District while under any period of probation and that he be required to participate in interviews with the Secret Service to help determine potential risks.

Both sides agreed that federal sentencing guidelines recommend zero to six months in prison, although Boasberg could go higher or lower.

During his time near the White House, Tran triggered multiple alarms and at various points peered into a White House window and hid behind a pillar, according to surveillance video and officer accounts. The Secret Service declined to comment on news reports that after the intrusion it fired two uniformed officers assigned to guard the Treasury building and the entrance to East Executive Avenue.

Before Thursday’s appearance, Tran had been released to his family’s home in Northern California, subject to court and electronic monitoring, mental evaluation and treatment if ­necessary.

According to a criminal complaint filed March 11, Tran also had been carrying a book about President Trump, a U.S. passport and a laptop containing a letter addressed to the president about Russian hackers, saying Tran had found “information of relevance.”

Tran stated that he had jumped the fence and added, “I am a friend of the president,” Secret Service officer Wayne Azevedo wrote in an affidavit at the time of Tran’s arrest.

The breach was thought to be the first fence-jumping since Trump took office.

Trump, who was at the White House that night, praised the Secret Service for doing “a fantastic job” responding to a “troubled person.”