Facts
The appellant, an Algerian national born in 1983, entered Switzerland in 2008 and filed an asylum application in the canton of Bern. A decision of non-entry into the merits was issued, confirmed by a judgment of the Federal Administrative Court of 7 March 2008. A decision ordering his removal from Switzerland, which became final on 25 March 2008, was issued. Since then, he has been residing illegally in Switzerland.
Since June 2014, the appellant has been in a romantic relationship with a Swiss national domiciled in the canton of Jura, mother of two children born in 2011 and 2013. Between 2008 and 2016, he was criminally convicted fifteen times, five of them in the canton of Jura, to custodial sentences ranging from thirty days to six months, notably for offences under the FSCA and the legislation on foreigners.
By decision of 3 May 2016, the Population Service of the canton of Jura (the cantonal service) imposed on the appellant a ban on entering the cantonal territory for two years, effective from 8 May 2016. On 4 July 2016, the administrative judge of the Court of First Instance dismissed the appeal lodged against this decision. On 14 July 2016, the appellant brought the matter before the Cantonal Court. The administrative judge transmitted her observations on 20 July 2016 and the cantonal service replied on 9 August 2016. By order of 11 August 2016, the Cantonal Court forwarded these submissions to the appellant (art. 105 para. 2 FSCA), the order indicating that the judgment would be rendered after 22 August 2016. On 17 August 2016, the Cantonal Court nevertheless dismissed the appeal.
The appellant simultaneously lodged an appeal in public law matters and a subsidiary constitutional appeal, requesting annulment of the judgment and remittal of the case, alleging violation of his right to be heard and of the principle of proportionality. The Cantonal Court declared that it acquiesced to the appeal on the violation of the right to be heard. The cantonal service waived the right to comment on this complaint. The State Secretariat for Migration waived the right to file observations.
Main question: whether the Cantonal Court violated the appellant's right to be heard by rendering its judgment before the expiry of a sufficient period to exercise the right of reply, and the admissibility of the parallel subsidiary constitutional appeal.
Considerations
The Federal Supreme Court examines of its own motion its jurisdiction and the admissibility of the appeals. The subsidiary constitutional appeal is only open if the decision cannot be the subject of an ordinary appeal (art. 113 FSCA). The contested judgment, concerning a ban on entering the cantonal territory, constitutes a final decision (art. 90 FSCA) rendered by a higher court as last cantonal instance in a public law matter (art. 82 let. a, 86 FSCA), not covered by the exceptions of art. 83 FSCA. The appeal in public law matters is therefore open and the subsidiary constitutional appeal is inadmissible.
On the merits, the appellant alleges a violation of the right of reply, arising from art. 29 para. 2 Cst. This right entails being able to become acquainted with and respond to any argument submitted to the court, without the judge assessing whether the submission contains decisive elements. Where a party is represented by a lawyer, the lawyer must respond directly or request a time limit, failing which he is deemed to have waived the right. The court must nevertheless grant a sufficient period, in principle at least 10 days. The ECtHR has accepted this practice under art. 6 para. 1 ECHR.
In this case, even assuming immediate notification of the order on 12 August 2016, the appellant would have had only five days before the judgment of…