
841 P.2d 441 (1992)
122 Idaho 911
Kenneth BRENNAN, Petitioner-Appellant,
v.
STATE of Idaho, Respondent.
No. 19754.
Court of Appeals of Idaho.
October 6, 1992.
*442 Kenneth Brennan, pro se.
Larry J. EchoHawk, Atty. Gen., Robert R. Gates, Deputy Atty. Gen., Boise, for respondent.
Before WALTERS, C.J., SWANSTROM, J., and BECKER, J., pro tem.
PER CURIAM
This is an appeal from a district court's order affirming a magistrate's dismissal of Kenneth Brennan's petition for a writ of habeas corpus. We affirm.
The relevant facts and procedural history of this case are as follows. In January, 1988, Brennan was sentenced by the District Court of the Second Judicial District for Nez Perce County, to two concurrent sentences of fifteen years for convictions on two counts of attempted robbery. Each of the sentences required incarceration for a minimum period of seven years. After sentencing, Brennan was committed to the custody of the Board of Correction and was transferred from the Nez Perce County jail to the state prison in Boise.
On March 2, 1988, Brennan appealed his conviction, asserting that his fifth amendment rights had been violated during a police interrogation at the time of his arrest. On January 8, 1990, this Court vacated Brennan's judgment of conviction and remanded the case to the district court for a more particularized finding as to whether Brennan's fifth amendment rights were violated. We also held that, should Brennan be reconvicted on remand, his convictions should be for conspiracy to commit robbery rather than attempted robbery. State v. Brennan, 117 Idaho 123, 785 P.2d 687 (Ct. App.1990).
After his judgment and sentences were vacated, Brennan remained at the state prison for over a year, while awaiting further proceedings on remand, rather than being transported back to the county jail in *443 Nez Perce County. During this time, Brennan was the subject of approximately five disciplinary proceedings at the prison. Brennan was found guilty of the alleged offenses in each proceeding, and the resulting disciplinary offense reports (DOR's) became a part of Brennan's institutional record.
In January, 1991, just over a year after his conviction and sentence had been vacated, Brennan filed a petition for writ of habeas corpus in the magistrate division of the Fourth Judicial District, in Ada County, asserting that he was being confined illegally because he was being held in the custody of the Board of Correction without any conviction or sentence in effect. In his prayer for relief Brennan requested a declaratory judgment in his favor and an order for his immediate release from custody. On March 1, 1991, the magistrate issued an order to supplement the petition, noting that since Brennan filed his petition, the Second District court had conducted further proceedings on remand, had reconvicted Brennan and had scheduled a resentencing hearing for March 13. The magistrate's order required Brennan to supplement his petition by March 23, stating the outcome of the resentencing hearing and indicating what, if any, effect the resentencing had on his petition for habeas corpus relief. At the resentencing hearing, the Second District court gave Brennan the same sentences as imposed after his original convictions, as well as credit for time served.
On April 9, 1991, Brennan filed his amended and supplemented petition for writ of habeas corpus. Brennan continued to assert that after his conviction and sentences were vacated by this Court his confinement under the custody of the Board of Correction was illegal, and that under I.C. § 20-604 he should have been transferred back to the county jail within the jurisdiction of the Second District court, where his case had been remanded. However, inasmuch as he was now confined pursuant to a valid judgment of conviction and sentence, Brennan no longer sought release from confinement; rather, he asked the court to order expungement from his prison record of the DOR's he had received during the allegedly illegal period of confinement. Brennan insisted that, because his confinement in the state prison system between January 8, 1990, and March 13, 1991, was in violation of I.C. § 20-604,[1] the Board of Correction lacked authority to hold disciplinary proceedings against him during that time, and therefore his institutional record should be expunged of the DOR's he received as a result of those proceedings. Brennan argued that under I.C. § 20-604 presentence detainees have a liberty interest in being held in county jails rather than in the state prison system. He maintained that he was deprived of that liberty interest in violation of the due process protections of the state and federal constitutions, and that he was harmed by this alleged deprivation because, had he been transported to the county jail as he claims he was entitled, his prison file would not contain the DOR's which he received at the state prison. Finally, Brennan alleged that the DOR's continued to harm him by impairing his classification within the prison system and by reducing his chances for parole.
On April 17, 1991, the magistrate dismissed Brennan's petition, concluding that even if Brennan had been confined illegally, expungement of the DOR's he received during the illegal period of confinement would not be an appropriate remedy. Brennan appealed the dismissal of his petition to the district court, which affirmed the magistrate's ruling, reasoning that it would be anomalous to say that Brennan should receive full credit for the time he spent in confinement during the pendency of his case on remand, but that he should not be held accountable for the institutional offenses he committed during that time.
Brennan has appealed from the district court's affirmance of the magistrate's dismissal, *444 and for the reasons set forth below, we also affirm.

ISSUES ON APPEAL
Brennan's arguments raise two primary issues on appeal: (1) whether the Board of Correction had authority to conduct disciplinary proceedings against Brennan, an inmate within the Board's custody, although Brennan was not under sentence at the time; and (2) whether the Idaho statutes governing the state prison and county jails entitle presentence detainees to be held in county jails as opposed to state prison facilities, and, if they do, what the appropriate remedy is for a deprivation of that right.

STANDARD OF REVIEW ON APPEAL
We note, preliminarily, that when we review the appellate decision of a district court, our task is to independently examine the trial record to determine whether the findings made by the magistrate are supported by substantial evidence and whether the magistrate correctly applied the law to the facts as found. Sivak v. Ada County, 118 Idaho 193, 195, 795 P.2d 898, 900 (Ct.App.1990); Knopp v. Nelson, 116 Idaho 343, 344, 775 P.2d 657, 658 (Ct.App.1989). The question before us is whether the magistrate abused his discretion in dismissing Brennan's petition for writ of habeas corpus. Whether to issue a writ of habeas corpus is a matter within the discretion of the court. Johnson v. State, 85 Idaho 123, 127, 376 P.2d 704, 706 (1962). When appealing from the denial of a petition for writ of habeas corpus, the petitioner has the burden of establishing error. Hernandez v. State, 100 Idaho 581, 602 P.2d 539 (1979). When we review an exercise of discretion in a habeas corpus proceeding, we conduct a multi-tiered inquiry to determine: (1) whether the lower court rightly perceived the issue as one of discretion; (2) whether the court acted within the outer boundaries of such discretion and consistently with any legal standards applicable to specific choices; and (3) whether the court reached its decision by an exercise of reason. Sivak v. Ada County, 115 Idaho 762, 763, 769 P.2d 1134, 1135 (Ct.App.1989).

ANALYSIS
1. The Board of Correction's Authority over Brennan. Brennan asserts that although he was in the custody of the Board of Correction during the allegedly illegal period of confinement, the Board lacked authority to subject him to its rules and disciplinary procedures because, as a presentence detainee, he should have been transported back to the custody of the county jail under the jurisdiction of the Second Judicial District. In Sivak v. State, 112 Idaho 127, 730 P.2d 1047 (Ct.App.1986), we addressed a situation where the inmate's sentence had been vacated but he remained incarcerated at the penitentiary pending resentencing in the district court. We said:
In light of I.C. § 20-101, it would appear improper for the board of correction to obtain custody and hold any offender at one of its institutions where the offender has not been both convicted and sentenced in respect to some charge.
Sivak, 112 Idaho at 128, 730 P.2d at 1048. We footnoted this language, by stating:
This broad observation should be subject to the possibility of special arrangements made between the board of correction and other agencies, for example where, by court order or by contract with another department, the board obtains temporary custody of an individual for diagnosis, evaluation, treatment or similar matters.
Sivak, 112 Idaho at 128 n. 5, 730 P.2d at 1048 n. 5. After his conviction and sentences were vacated, Brennan was no longer under sentence, and it does not appear from the record that any special arrangements between the Board of Correction and the county jail were made for the Board to retain temporary custody of Brennan pending the outcome of his case on remand. Therefore, according to our statements in Sivak, it was improper for the Board of Correction to retain custody of and hold Brennan at one of its institutions after Brennan's conviction and sentences were *445 vacated. Consequently, Brennan should have been transferred back to a county jail in the Second Judicial District within a reasonable time.
However, even though Brennan should have been transported to the county jail it does not follow that the Board of Correction lost jurisdiction and authority over Brennan while he remained in the actual custody of the Board. In a case such as this, where a sentence is vacated and remanded on appeal, there will always be some time elapsing between the vacation of the sentence and the transfer of the prisoner to the custody of the proper sheriff. It cannot be argued that the Board of Correction immediately loses "custody" over an inmate when the inmate's conviction or sentence is vacated and his case is remanded to the district court for further proceedings. During the time between vacation and transfer of the prisoner to the custody of the county sheriff, the Board of Correction must necessarily retain jurisdiction and control over the inmate until that transfer is carried out. As long as the prisoner is under the care and custody of the Board of Correction, important public policy considerations dictate that the prisoner be subject to the rules and procedures of the institution.
In a case such as this where the inmate's transfer is not properly executed, but is unreasonably delayed or simply not carried out, the inmate's remedy is to commence an administrative grievance procedure at the prison, or, as Brennan did here, file a petition for habeas corpus relief.[2] Acceptance of Brennan's argument  that the Board of Correction had no authority over him after his sentences were vacated and thus could not discipline him  would contravene important public policy considerations, inasmuch as it would allow inmates who were subject to transfer to the custody of other governmental agencies, but who had not yet been transferred, to disregard and violate with impunity the rules of the transferring custodian. This would subject custodial officers, other inmates, public property, and the public itself, to unwarranted risks of harm.
While the public's interest in ensuring that inmates and detainees comply with the rules and procedures of the institutions to which they are confined are obvious, we also acknowledge that inmates have individual interests in not being unlawfully confined. However, adoption of the rule proposed by Brennan would do nothing to further the inmate's legitimate interests in being transferred to the appropriate facility. To secure and protect those legitimate interests, Idaho's habeas corpus statutes provide an effective remedy for inmates who believe they are being confined unlawfully. Idaho Code § 19-4201 provides that "Every person unlawfully committed, detained, confined or restrained of his liberty, under any pretense whatever, may prosecute a writ of habeas corpus, to inquire into the cause of such imprisonment or restraint." Other sections of the statutory scheme provide for civil and criminal liability against custodians who refuse or disregard a writ issued by the court. I.C. §§ 19-4233 and -4234 to -4236. In this case, although Brennan's petition for writ of habeas corpus was ultimately dismissed, shortly after he filed his petition the judicial process which had been delayed for so *446 long was put into motion and Brennan was thereafter duly convicted and resentenced to confinement in the custody of the Board of Correction. This was the process and the remedy which Brennan was due with respect to his apparently inappropriate confinement. We reject Brennan's argument that his remedy was to be exempt from the rules and procedures of the institution where he was being held.
While we do not countenance the breakdown or delay which occurred in the judicial process in Brennan's case, it is significant that Brennan did not file his petition for habeas corpus relief until over a year after his conviction and sentences had been vacated, and after he had already received the five DOR's. Brennan could have filed a petition for writ of habeas corpus many months before he chose to do so, and well before he committed the offenses which resulted in the DOR's. Brennan was entitled to file for habeas corpus relief to remedy his apparently improper confinement in the state prison, in order to bring about his transfer to the correct institution, but he was not entitled to violate the prison rules without punishment. While he was in the custody of the Board of Correction, Brennan was subject to the Board's rules, and the Board had authority to conduct disciplinary proceedings against him to adjudicate his violations of those rules so long as he remained in the actual custody of the Board and until he was lawfully released from that authority.
2. Deprivation of a Protected Liberty Interest. Brennan also asserts that by being confined contrary to the provisions of I.C. § 20-604, he was deprived of a protected liberty interest without due process of law. Brennan asserts that by virtue of Idaho's code sections governing the state prison and county jails he was entitled to be incarcerated in the county jail as opposed to the custody of the Board of Correction. He further asserts that he was deprived of that entitlement without due process of law, that the DOR's in his institutional file resulted from that deprivation, and that those DOR's have harmed and continue to harm him because, as part of his institutional record, the DOR's adversely affect his possibilities for upgraded status within the prison system, as well as his chances for parole. Brennan contends that the length and conditions of his confinement have been negatively affected by his DOR's, which, he claims, resulted from his allegedly illegal confinement, and therefore the DOR's should be expunged from his prison records.
Because we conclude that Brennan's constitutional argument is fatally flawed in two other respects, we need not discuss whether, under Idaho's statutes governing the state prison and county jails, Brennan actually had a protected liberty interest as a presentence detainee in being held in the county jail versus the state prison. We will assume, solely for the purposes of our analysis, that Brennan had such a protected interest.[3]
The first flaw in Brennan's argument is that, even assuming he had a substantive right to be in jail instead of prison, Brennan was not denied the constitutional protections of due process in securing that right for himself. As mentioned above, at all times during the year that Brennan remained at the prison after his sentence had been vacated, during which time he received the DOR's, Brennan could have filed a petition for writ of habeas corpus, asserting the unlawful nature of his confinement, requesting that he be transferred to the custody of the sheriff of Nez Perce County, and seeking a speedy disposition of his criminal case. That was the process Brennan was due, and the record does not show that Brennan was deprived of that process at any time. When Brennan finally availed himself of the habeas corpus procedures, he received a speedy disposition of his case, and the allegedly unlawful nature of his confinement was cured.
The other flaw in Brennan's argument is that he has failed to show that the alleged deprivation  confinement in prison rather than jail  caused the harm he claims, that is, the DOR's on his prison *447 record. Obviously, had Brennan been in a county jail during 1990 he would not have received DOR's on his prison file during that time. But that does not mean that Brennan received the DOR's solely because he was in prison, as opposed to jail, during that time. Based on the record before us, we must conclude that it was possible for Brennan to have remained in prison during 1990 without getting any DOR's on his record. Brennan himself admits that he did not have any DOR's during the prior two years he was confined in the prison. Nor has Brennan shown that, had he been in jail rather than prison during this time, he either would not have committed the acts which resulted in the DOR's, or if he had, that such acts would not have resulted in disciplinary proceedings or have been recorded at the jail. Nor has Brennan shown that had he committed the disciplinary violations in jail rather than in the prison, his current prison file, which is reviewed by the classification committee and the parole commission, would not contain a record of those offenses. In short, Brennan has failed to show that the harm he alleges was caused by his confinement in the state prison as opposed to the county jail. Because Brennan has failed to show that he was denied due process of law, or even that the alleged deprivation caused the harm he claims, Brennan has failed to show that his constitutional rights were violated, and that he is entitled to the remedy he seeks.
We will briefly address two other arguments which Brennan raises on appeal. Brennan also challenges the magistrate's failure to address his claim that he was denied his sixth amendment right to a speedy disposition of the criminal charges against him. The record shows, however, that Brennan failed to raise this issue in his appeal from the magistrate division to the district court. Nor was this issue considered or decided by the district court on its merits. We will not consider an issue on appeal which the appellant failed to raise on appeal to the intermediate court. Gordon v. Noble, 109 Idaho 1048, 712 P.2d 749 (Ct.App.1986); Konic Intern. Corp. v. Spokane Computer Services, 109 Idaho 527, 708 P.2d 932 (Ct.App.1985); Centers v. Yehezkely, 109 Idaho 216, 706 P.2d 105 (Ct. App.1985).
Finally, Brennan also contends that the magistrate erred in dismissing his petition without issuing a writ and requiring the state to file a return to it. It is well settled that the court to whom a petition for writ of habeas corpus is presented may "dispose of such party as the justice of the case may require." Mahaffey v. State, 87 Idaho 228, 231, 392 P.2d 279, 280 (1964), citing I.C. § 19-4212 and Matter of McLeod, 23 Idaho 257, 128 P. 1106 (1913). No return is required unless the writ is issued. I.C. § 19-4208. As noted earlier, the decision whether to issue a writ is one governed by the discretion of the petitioned court. If Brennan's allegations would not entitle him to relief even if proved, the magistrate would commit no error by dismissing the petition without issuance of a writ requiring the custodian to file a return and affording an evidentiary hearing. Because Brennan was not entitled to the relief he sought, the magistrate did not abuse his discretion in dismissing the petition and refusing to issue the writ without requiring the state to file a return.

CONCLUSION
Based on the reasoning set forth above, we hold that the magistrate rightly perceived the issue whether to grant Brennan's petition as one of discretion, that the magistrate acted within the outer boundaries of such discretion and consistently with the applicable legal standards, and that the magistrate reached his decision by an exercise of reason. Because we conclude that the magistrate did not abuse his discretion in dismissing Brennan's petition for writ of habeas corpus, we uphold the district court's affirmance of that dismissal.
NOTES
[1]  We note that I.C. § 20-604 actually does not require the incarceration of a person, pending entry of a judgment of conviction or sentence, in any particular jail. The section merely authorizes the courts of the judicial district where a jail is located to use that jail as a repository.
[2]  The record in this case fails to disclose the reason why Brennan was not promptly transferred back to Nez Perce County following our decision to vacate his conviction and sentences. The facts of this case seem rare inasmuch as the Board of Correction has every incentive, because of the fiscal and logistical demands and limitations placed on its staff and facilities, to transfer inmates back to the county jails whenever it is legally possible to do so. The issuance of our opinion vacating Brennan's conviction and sentences, even if communicated to the Board of Correction at the time, would not necessarily have generated any required action by the Board to transport Brennan out of the penitentiary, inasmuch as that opinion was subject to procedures for rehearing Brennan's appeal and for review by the Supreme Court. It was the remittitur from this Court remanding the case to the district court for Nez Perce County at the completion of the appellate process which set the stage for further proceedings. The responsibility to carry out the directions in the remittitur by scheduling a hearing and arranging for Brennan's transport back to Nez Perce County rested, of course, with the district court and not with the Board.
[3]  See footnote 1, supra.
