Facts

The appellant ([A.] ) served a prison sentence at the Lenzburg correctional facility until 27 September 2017. On 26 September 2017 the Zurich-Limmat Public Prosecutor's Office ordered his provisional arrest from 28 September 2017 and on 27 September 2017 applied to the Compulsory Measures Court of the District of Zurich for pre-trial detention in respect of offences committed while serving his sentence. By order of 29 September 2017 the Compulsory Measures Court ordered pre-trial detention on grounds of risk of reoffending.

The appellant challenged this decision before the Zurich Cantonal Court of Appeal, which dismissed the appeal by decision of 20 October 2017.

In the appeal proceedings the appellant filed an appeal on 6 October 2017. The Cantonal Court of Appeal obtained observations: the Compulsory Measures Court waived comments on 9 October 2017, and the Public Prosecutor's Office applied on 10 October 2017 for dismissal. By order of 12 October 2017, addressed to the legal representative, the Cantonal Court of Appeal set a time limit 'for an optional reply within 3 working days, calculated from receipt'. The registered consignment was posted on 12 October 2017, a notice of attempted delivery was left on 13 October 2017, and collection was required by 20 October 2017. The legal representative collected the consignment on 20 October 2017. Already on 20 October 2017 the Cantonal Court of Appeal issued the detention decision, which was served on the legal representative on 23 October 2017. The Cantonal Court of Appeal noted that the appellant had waived a reply.

By appeal in criminal matters of 8 November 2017 the appellant requested annulment of the Cantonal Court of Appeal's decision and remittal. He complained of violation of the right to reply and of the right to be heard and to a fair trial (Art. 6 para. 1 ECHR, Art. 29 para. 2 Cst.). He also filed an application for legal aid and appointment of counsel. The Public Prosecutor's Office and the Cantonal Court of Appeal waived a response.

Considerations

An appeal in criminal matters is available against the final cantonal decision on detention (Art. 78 ff. FSCA). The appellant, as a detainee and direct addressee of the decision, has standing to appeal (Art. 81 para. 2 FSCA). A complaint may be raised concerning violation of federal law, including federal constitutional law (Art. 95 lit. a FSCA).

The violation of the right to a fair trial (Art. 6 para. 1 ECHR) and of the right to be heard (Art. 29 para. 2 Cst.) is of a formal nature. Regardless of the substantive merits, it leads to the upholding of the appeal and the annulment of the decision where a cure at the higher instance is not an option. The right to reply encompasses the right to be informed of submitted observations and to respond to them. It does not depend on whether the submissions are relevant to the decision. The party must be served with the submissions, and the court must also guarantee an effective right to reply in terms of timing.

Under Art. 85 CrimPC, a registered consignment is deemed served when it is accepted; an uncollected consignment is deemed collected on the seventh day after the unsuccessful delivery attempt, provided that service had to be expected. Time limits begin to run on the following day (Art. 90 para. 1 CrimPC). Leaving a notice of attempted delivery in the post office box is equivalent to a delivery…