Kevin Federline filed a police report — and was granted a restraining order — against Britney Spears’ dad, Jamie Spears, after a fight involving the couple’s 13-year-old son, Sean Preston, Us Weekly can confirm.

The report was filed following a heated argument between Preston and his grandfather, 67, at Jamie’s condo on August 24, a law enforcement source told Us.

“Britney had the boys at Jamie’s condo on the evening of August 24. Jamie and Sean Preston got into an argument. Sean Preston felt unsafe and locked himself into a room. Jamie broke into the room and shook Sean Preston,” the insider said.

“Jamie has a temper, which is no secret to anyone in the family,” another insider told Us. “Fortunately, Britney did the right thing and took her boys to safety and away from her father. The whole incident was very upsetting to her and her boys. Kevin was and still is furious.”

The source added, “Preston was not physically injured but very scared and shaken up.”

Federline, 41, and his attorney Mark Vincent Kaplan went to court on August 27 for an emergency hearing to seek a restraining order against Jamie. The order was granted with no opposition from Jamie and prohibits the grandfather from coming near Preston and his brother, Jayden James, 12, for three years, a third source tells Us.

“I went with Kevin on August 25 to the Ventura County Sheriff’s Department to help him navigate the legally complex issues in hopes of obtaining an emergency protective order against the conservator, Jamie Spears,” Kevin Federline’s powerhouse divorce attorney Kaplan told Us.

The conditions also state that an adult Federline approves of must be present whenever Preston and Jayden are with Britney, according to the source, and it can’t be Jamie. The source added that neither Britney, 37, nor Jamie were at the hearing, while Federline was on standby in case he needed to testify.

Sgt. Marta Bugarin, a spokesperson for the Ventura County Sheriff’s Office, told Us, “Jaime has not been arrested, and it will be up to prosecutors to investigate the allegations and file any possible charges.”

Bugarin said that investigators plan to submit their findings to the Ventura County District Attorney’s Office on Wednesday, September 4.

“Jamie left town before cops could question him. He hasn’t made himself available to authorities to answer questions investigators have,” the third source told Us.

The allegations against Jamie surfaced as Britney and her ex-husband’s custody arrangement was changed. Federline will receive custody of the boys 70 percent of the time, which has been an informal arrangement since August 2018 but was made official in court on August 28. The pair previously had 50-50 custody since 2007.

Britney and the former backup dancer divorced in July 2007 after two years of marriage.

With reporting by Nicholas Hautman, Marjorie Hernandez and Jennifer Heger