
62 Cal.App.4th 363 (1998)
SHERMAN BLOCK, as Sheriff, etc., Petitioner,
v.
THE SUPERIOR COURT OF LOS ANGELES COUNTY, Respondent; ROBERT JOHN DOWNEY, JR., Real Party in Interest.
Docket No. B119878.
Court of Appeals of California, Second District, Division Two.
March 19, 1998.
*365 COUNSEL
De Witt W. Clinton, County Counsel, S. Robert Ambrose, Assistant County Counsel, and James M. Owens, Principal Deputy County Counsel, for Petitioner.
No appearance for Respondent.
No appearance for Real Party in Interest.
OPINION
BOREN, P.J.
Petitioner, Sherman Block, Sheriff of the County of Los Angeles (hereafter Sheriff), seeks a writ of mandate directing the superior court to set aside its order of March 3, 1998, directing the Sheriff to release real party in interest, Robert John Downey, Jr., from custody and to transport him  at Downey's expense  to Paramount Studios to complete work on a motion picture. The question is whether, pursuant to Penal Code section 4004 (hereafter section 4004), good cause exists for Downey's release. We conclude it does not. Because the issue is now moot, we will deny the petition. Because the issue is capable of recurring, we issue this opinion to lay down general guidelines for future cases.

I. FACTUAL AND PROCEDURAL HISTORY
Downey, a well-known actor, was convicted of violating Health and Safety Code sections 11350, subdivision (a) and 11550, subdivision (a), Penal Code section 12025, and Vehicle Code section 23152, subdivision (a). His sentence was suspended, and he was placed on summary probation, one of the terms of which was that he was required to seek and maintain employment as approved by the court.
*366 On April 22, 1997, Downey moved to modify the terms of his probation. The court was informed that Downey was impossible to insure in light of the fact that he could be incarcerated at any moment for a violation of probation. In order to become insurable, and thus employable in his chosen profession, Downey needed an order modifying the terms of his probation such that the studios would be assured of some predictability in their contractual relations with Downey.
In granting the motion, the superior court noted that employment "funds all of the various activities one does in terms of rehabilitation," and that it "also gives one the necessary self-respect that one needs in order to develop the strength and courage to stay away from addictive substances." The court concluded that "rehabilitation is virtually impossible in most circumstances ... unless [the defendant] can gain employment." The court's order was thoughtful and fashioned to meet the unique circumstances in which Downey found himself. The court indicated that if advised of a probation violation that did not involve a substantial danger to the public, the court would  if "comfortable" that Downey would "maintain his sobriety"  allow Downey to "finish his commitment" before ordering him incarcerated or into a lock-down program. If, on the other hand, the court was notified of a violation involving a substantial danger to the public, then the court would issue a no-bail warrant, and Downey would thereafter be incarcerated. The court agreed, however, that if it became aware of a probation violation not involving a substantial danger to the public, the court would set a probation violation hearing that would not interfere with the shooting schedule, not to exceed 48 hours. In deference to the fact that numerous other people would be affected should Downey be immediately incarcerated, the court further agreed that it would allow the work set to begin October 18, 1997, to continue until December 7, 1997, the date the movie was scheduled to be completed. The prosecutor lodged no objection to the terms set forth by the court.
In announcing its decision, the court emphasized that even though the order was tailored to Downey's specific employment requirements, such individualized sentencing orders had been made in the past by the court in noncelebrity cases in order to allow a defendant to remain employed.
Sometime in September 1997, for about a five-day period, Downey, in violation of his probation, used alcohol and controlled substances. A hearing was set for October 17, 1997. To his credit, Downey advised the court of the violation, and admitted the probation violation. Upon being informed of the violation, the court stated, "So what I have here is really an unfortunate circumstance for me, and that is that I believe I'm committed to permit you *367 to continue in this effort you're making with this particular film." The court then revoked Downey's probation. The court, not unmindful of the effect such a revocation would have on the studio with which Downey had contracted, worked out a plan by which Downey would be permitted to complete filming. The court set the probation violation hearing (designed to explore the circumstances under which the violation occurred) for December 8, 1997. The court then ordered Downey to reside in a sober living facility, to be tested on a daily basis, and to have a counselor available every day. The court also directed Downey to have a bodyguard with him 24 hours a day during the course of the filming, with the bodyguard responsible for notifying the court of any probation violation. The court warned that if Downey violated these conditions of his release, the court would issue a no-bail warrant. Downey, again to his credit, did not violate the conditions of his release, and, as he agreed to do, appeared for the probation violation hearing on December 8, 1997. On that day, the court found, based on Downey's prior admission, that he had violated his probation in September 1997, by using alcohol and controlled substances. The court revoked Downey's probation, reinstated probation for a period of three years dating from December 8, 1997, and sentenced him to 180 days in county jail. The order expressly provides that Downey would not be permitted to be incarcerated in a city jail. Rather, Downey was to be incarcerated in the county jail.
On January 6, 1998, Downey moved the superior court for an order releasing him to a lock-down facility. The court denied the motion. In doing so, the court noted that it believed Downey was sincere in his effort to become rehabilitated. The court also noted, however, that the court's intent in sentencing Downey to jail was to "punish him for the use of drugs." The court then stated, "I'm hoping that by doing that it will trigger in him a response that will get him to be more meaningfully involved in rehabilitation."
In January 1998, Downey successfully moved to be released from county jail in order to participate in postproduction work on the movie he had completed in December 1997. The prosecution took no position as to the merits of the motion, and it was granted. In February 1998, Downey filed a second request. Again, the request was granted. On March 3, 1998, Downey filed a third request. He asked that he be released from jail on March 4, 1998, and on March 6, 1998, to complete postproduction work necessary for the release of the motion picture.
The Sheriff opposed the motion on the grounds that section 4004 does not authorize the release of a sentenced inmate absent good cause, that the order *368 impermissibly required a significant deployment of law enforcement personnel, and that it gave the appearance that Downey could purchase special rights and privileges not readily available to other county jail inmates.
The superior court granted the motion, characterizing it as a "work release request."[1] The court directed the Sheriff to transport Downey "directly" to the movie studio. The court also directed that Downey was to be "in the custody of a deputy sheriff at all times." Downey was to be returned to jail at the conclusion of each respective business day. In addition, Downey was required to bear all costs associated with his release, and was not allowed credit for the time spent outside custody. Implicit in the court's order was that the Sheriff would deploy sufficient personnel to execute the operation. In granting Downey's motion, the court noted that the order "essentially [keeps] the court's commitment made not just to [Downey], but to all those people who basically agreed to contract with this defendant, based upon the fact that the court took a strong position and tried to define that position with some degree of predictability." The court also noted that it was looking past Downey's scheduled release date of March 29, 1998, with an eye to ensuring that Downey would be employable in the future.
On March 4, 1998, the Sheriff filed this petition for writ of mandate challenging the release order as made in violation of section 4004, and thus in excess of the superior court's jurisdiction.
In response to the petition, we issued an alternative writ of mandate notifying the superior court that it was required either to vacate its order of March 3, 1998, granting Downey's motion for release for postproduction procedures at Paramount Studios, and issued a new and different order denying the motion, or in the alternative, show cause before this court on March 16, 1998, why a peremptory writ of mandate ordering it to do so should not issue.
(1) (See fn. 2.) On March 11, 1998, we received a letter from Downey's counsel indicating that Downey did "not intend to file any opposition to the Writ of Mandate filed by the Los Angeles County Sheriff's Department."[2]
On March 13, 1998, we received notification from counsel for the Sheriff that, given Downey's letter of nonopposition, no oral argument was required. *369 Accordingly, we issued an order directing that no oral argument would be heard. Because the only unexecuted portion of the trial court's order pertains to March 6, 1998, and that date has passed, the petition is moot. However, because the issue may recur, we will issue this opinion.

II. CONTENTIONS
(2a) The Sheriff contends that the superior court was "without jurisdiction to issue an order releasing an inmate to facilitate a social visit."

III. DISCUSSION

A. Writ Relief

Neither party has cited authority defining the phrase "good cause" as used in section 4004. (3) Prerogative writs are appropriate "to review questions of first impression that are of general importance to the trial courts and to the profession, and where general guidelines can be laid down for future cases." (Oceanside Union School Dist. v. Superior Court (1962) 58 Cal.2d 180, 185-186, fn. 4 [23 Cal. Rptr. 375, 373 P.2d 439].)

B. Defining "Good Cause"

(4) Section 4004[3] allows the release of an inmate from county jail for "good cause." The Sheriff invites us to adopt the definition of good cause found in an advisory opinion issued by the Attorney General. The opinion holds that "[g]ood cause means the presence of a prisoner is necessary to the disposition of a criminal matter pending before the court making such an order," and concluded that "[t]he facilitation of a social visit is clearly not `good cause' which would authorize an order by the court." (46 Ops.Cal.Atty.Gen. 20, 21 (1965).) We decline the Sheriff's invitation since we can conceive of situations where the release of a prisoner in connection with what could be termed a "social visit" may well be appropriate.
The burden of showing that good cause exists for the release of an inmate in the custody of a law enforcement officer falls upon the defense. The *370 determination as to whether good cause has been demonstrated depends upon the circumstances of each case.
Implicit in the "good cause" requirement of section 4004 is that such orders will only be issued in exceptional circumstances, and then only rarely. Underlying a release order requiring police supervision is that such an order necessarily infringes upon a law enforcement agency in the lawful discharge of its responsibility to maintain the custody of prisoners committed to the agency's jail. Here, for example, the Sheriff is responsible for the safety and security of the Los Angeles County jail, and the staff and inmates at the jail. The release order, by its nature, diverted law enforcement officers from other functions in order to accompany Downey to his place of employment. Also underlying release orders such as the one issued here, i.e., that a deputy was to provide transportation to and from a particular location, and to provide security for the inmate while at that location, is that the agency is at risk of a lawsuit should an injury (to the inmate, officer or third parties) occur during the period of time the inmate is away from the jail. In exercising its discretion to order a prisoner released, the court must bear in mind that the resources of our law enforcement agencies are limited, and that such agencies may not, absent a compelling reason, be placed at risk of claims being made against it for omissions or actions of law enforcement personnel during the time of the inmate's release.
We now turn to what factors are to be considered in issuing a release order. The court must consider such things as whether the inmate would present a substantial danger to the public if released, whether the inmate has followed the rules and regulations of the agency housing him, and the nature of the activities in which the inmate hopes to engage once released. Most citizens, we believe, are comfortable with the idea that prisoners who pose little risk may, under certain circumstances, be released in the custody of law enforcement, in order to attend a funeral of a loved one. Such compassionate releases have an air of urgency about them since they usually come up unexpectedly, and are usually of short duration. We allow such releases from custody because as a society we believe that allowing a prisoner to attend a funeral or like event in order to honor a loved one's memory takes precedence (temporarily) over society's need to punish the prisoner.
(2b) The record reflects that Downey, although a threat to his own well-being, is highly unlikely to present a danger to the public. The record does not disclose whether Downey has followed the Sheriff's rules and regulations. We note, however, that he has an expectation of early release. This implies that he has earned what is called "good time" credit. Thus, it appears he could have satisfied this factor.
*371 We come now to the nature of the activities in which Downey was to be engaged upon release. The court was informed that Downey's presence was required so that he could finish postproduction work on a movie. The court was also informed that in the event Downey did not finish the movie, the release date of the film would be delayed, people would be put out of work, and Downey's employers would lose money. Such misfortunes befall employers and third parties to some degree in many criminal cases in which an employed defendant is sentenced to county jail. There is nothing exceptional about the circumstances in which Downey found himself. There was no emergency or exigent circumstances.[4] Downey was simply released to go to work, in the private sector, in order to be able to honor his current contractual obligations, and to make himself employable in the future. Many inmates, we believe, would benefit from such a release, and such a release undoubtedly would, as the court hoped in would in Downey's case, facilitate rehabilitation. Unfortunately, the Sheriff does not have the personnel to accommodate all removal requests. To allow one inmate to pursue his chosen profession, and to deny fellow inmates the same privilege is to sanction discrimination. This, we cannot condone. We conclude, therefore, that the order was not supported by good cause as that term is used in section 4004.
In making its order, the court noted that Downey would be required to pay the costs associated with his release should such an order be issued. The court suggested that Downey's ability to pay was a factor in its decision to grant the requested order. Ability to pay can never be a factor in determining whether good cause exists for the inmate's release. The first inquiry is whether good cause supports the release order. In making the order, the court is required first to review the policy considerations which mandate that release orders be issued only under exceptional circumstances. The court is then required to carefully consider the factors as set forth above in order to determine whether this is the type of rare case in which a removal order could be issued. If the court determines that a removal order should be granted, the court may then inquire into the inmate's financial ability to pay the costs associated with the inmate's release. If the court determines that the inmate has financial resources available to pay such costs, the court may condition the order upon such payment.
We commend the superior court for attempting to accomplish the simultaneous goals of punishing Downey while also promoting his rehabilitation by allowing him to honor his contractual obligations. Such goals may not, however, be accomplished by issuing an order pursuant to section 4004. This *372 does not mean that the court was without authority to fashion an order allowing Downey to complete postproduction work on a movie. The court could, on a proper showing, modify the terms of Downey's sentence, or the terms of his probation. Downey, like every other inmate sentenced to county jail, was placed there, at least in part, to be punished for a criminal act. When a defendant is incarcerated for his criminal conduct, the essence of that punishment is that he is deprived of freedom to attend social functions or to participate in employment opportunities. That purpose of punishment was abridged improperly here.

IV. DISPOSITION
The petition for writ of mandate is denied as moot.
Fukuto, J., and Nott, J., concurred.
NOTES
[1]  The criteria for release to a work release program are set forth in Penal Code section 4024.2. A review of the section reveals that it does not permit release of a prisoner to work in the private sector.
[2]  Failure to answer the petition is considered an admission of the truth of the allegations. (Rodriguez v. Municipal Court (1972) 25 Cal. App.3d 521, 526 [102 Cal. Rptr. 45].) "[A] peremptory writ cannot [however] be granted by default and the case must be heard by the court whether the adverse party appears or not [citation]." (Ibid.)
[3]  Section 4004 provides, in pertinent part, as follows: "A prisoner committed to the county jail ... upon conviction for a public offense, must be actually confined in the jail until he is legally discharged; and if he is permitted to go at large out of the jail, except by virtue of a legal order or process, it is an escape; provided, however, that during the pendency of a criminal proceeding, the superior court or an inferior court, as the case may be, before which said proceeding is pending may make a legal order, good cause appearing therefor, for the removal of the prisoner from the county jail in custody of the sheriff."
[4]  The circumstances presented in our record suggest the ease with which the justification for release presented here could be contrived.
