A woman was arrested Sunday for breaking into a closed courtroom where she had a previous custody case at Brooklyn Supreme Court, law enforcement sources said.

Jessica Pena, 35, allegedly used an ax to bust through a window at the Downtown Brooklyn courthouse at 320 Jay Street, sources said.

From there, Pena, of Brooklyn, made her way to an 18th-floor courtroom, where she was discovered by cops, sources said.

Pena, who has 14 prior arrests, was charged with criminal mischief and criminal trespass, according to sources.

In a similar incident, a brick was used to break a window at Queens Criminal Court on April 11. A window was also smashed at Manhattan Supreme Court last week, the sources added.

“The courthouses are unsafe,” Dennis Quirk, president of the New York’s court officers association, told The Post.

“Someone could easily break into a courthouse at night and hide a gun in a bathroom, and then use it to kill someone — just like in ‘The Godfather.'”