> For AI agents: read the machine-readable documentation index at [https://corpuslaw.us/llms.txt](https://corpuslaw.us/llms.txt) or the single-file full reference at [https://corpuslaw.us/llms-full.txt](https://corpuslaw.us/llms-full.txt).

# 42 Pa.C.S. § 6503 — Right to apply for writ.

- **Citation**: 42 Pa.C.S. § 6503
- **Node Type**: section
- **Jurisdiction**: Pennsylvania (state)
- **Code Body**: Pennsylvania Consolidated Statutes (Aug. 2026 snapshot) (Pa.C.S.)
- **Official Source**: [https://www.palegis.us/statutes/consolidated/view-statute?txtType=HTM&ttl=42](https://www.palegis.us/statutes/consolidated/view-statute?txtType=HTM&ttl=42)
- **Canonical URL**: [https://corpuslaw.us/codes/pennsylvania/title-42/chapter-65/section-6503](https://corpuslaw.us/codes/pennsylvania/title-42/chapter-65/section-6503)
- **Semantic URL**: [https://corpuslaw.us/codes/pennsylvania/title-42/chapter-65/section-6503](https://corpuslaw.us/codes/pennsylvania/title-42/chapter-65/section-6503)

## Hierarchy

Title 42 > Chapter 65

## Text

(a) General rule.--Except as provided in subsection (b), an application for habeas corpus to inquire into the cause of detention may be brought by or on behalf of any person restrained of his liberty within this Commonwealth under any pretense whatsoever.

(b) Exception.--Where a person is restrained by virtue of sentence after conviction for a criminal offense, the writ of habeas corpus shall not be available if a remedy may be had by post-conviction hearing proceedings authorized by law.
