New York State Courts on Wednesday said they will not allow ICE agents to arrest undocumented immigrants in their buildings if they do not have a warrant issued by a judge.

The court system made the announcement in a directive, which changed a former protocol that said ICE agents could make arrests with warrants signed by the Department of Homeland Security.

“We have noticed that in the last six months it appears [ICE] have changed their policy and their tactics and they have understood our concern with making arrests in the court building so they have been making them in other locations,” Lucian Chalfen, a spokesperson with the Office of Court Administration, told The Post.

The New York Legal Aid Society, which represents defendants who cannot afford to hire a lawyer, praised the move.

“This new rule will truly help protect immigrant New Yorkers from the pervasive and rampant immigration enforcement at courthouses that we have seen on a regular basis since the start of the Trump Administration,” said Legal Aid Attorney-in-Chief Janet Sabel.

Under the new protocol, court security officers will have to file an “unusual occurrence report” for any law-enforcement action taken in the courthouses, including ICE officers who watch court proceedings while on duty, according to the directive.

ICE did not immediately return request for comment.