October 11, 2019 | 3:14pm | Updated October 11, 2019 | 7:17pm

President Trump acted unlawfully when he declared a national emergency in order to fund his long-promised border wall, a federal judge ruled Friday.

Texas federal Judge David Briones’ order left open the option that the justice could also temporarily bar use of the funds to construct the wall at the southern border.

The County of El Paso and an organization called Border Network for Human Rights sued Trump and the administration earlier this year, claiming the president violated the law when he declared a national emergency in order to divert funds from the Department of Defense to bankroll the project.

The judge agreed, writing Friday that the law “expressly forbids” the use of money appropriated by Congress for a purpose outside its original purpose.

Briones instructed lawyers for the plaintiffs to file proposed parameters within the next 10 days specifying the scope of the injunction they’re seeking to levy against the wall.

Lawyers for Trump did not immediately respond to a request for comment.

Trump border wall prototypes
Project manager James O’Loughlin explains border wall prototypes to President Trump in 2018.Getty