
684 So.2d 868 (1996)
David Starr WILLIAMS, Appellant,
v.
Roderick JAMES, Appellee.
No. 95-01030.
District Court of Appeal of Florida, Second District.
December 13, 1996.
David Starr Williams, pro se.
Robert A. Butterworth, Attorney General, Tallahassee, and Doquyen T. Nguyen, Assistant *869 Attorney General, Ft. Lauderdale, for Appellee.
PATTERSON, Judge.
David Williams appeals from the denial of his petition for a writ of habeas corpus challenging the loss of gain time as a result of a disciplinary report. He argues that he was denied due process rights at his disciplinary hearing because the Department of Corrections (DOC) failed either to produce a requested witness in person or to note on the record the reason for declining to call the witness. We agree and reverse. However, as a procedural matter, since Williams did not allege that he would be entitled to immediate release but for the loss of the gain time, we treat Williams' petition for habeas corpus as a petition for a writ of mandamus. See Newsome v. Singletary, 637 So.2d 9 (Fla. 2d DCA 1994) (writ of mandamus is proper remedy to review denial of gain time). A writ of mandamus is the means by which a clear legal right is enforced and, although it cannot be used to compel a public agency to exercise its discretionary powers in a given manner, it may be used to compel the agency to follow its own rules. Turner v. Singletary, 623 So.2d 537 (Fla. 1st DCA 1993).
In Wolff v. McDonnell, 418 U.S. 539, 94 S.Ct. 2963, 41 L.Ed.2d 935 (1974), the Supreme Court held that inmates facing disciplinary charges must be afforded certain minimal procedural safeguards. Relevant to this case is the right to present witnesses and documentary evidence. Although an inmate does not have an absolute right to have witnesses present at his hearing, prison officials must explain their reasons for denying an inmate's request to call witnesses. Ponte v. Real, 471 U.S. 491, 105 S.Ct. 2192, 85 L.Ed.2d 553 (1985); Department of Corrections v. Marshall, 618 So.2d 777 (Fla. 1st DCA 1993); Holcomb v. Department of Corrections, 609 So.2d 751 (Fla. 1st DCA 1992).
Florida Administrative Code Rule 33-22.007(c)[1] states:
Witnesses shall not be called or certain information disclosed if doing so would create a risk of reprisal, undermine authority or otherwise present a threat to the security or order of the institution. The inmate witnesses must be willing to testify but may offer an oral or written statement to the investigating officer in lieu of a personal appearance. Notations shall be made in the report with reasons for declining to call requested witnesses or for restricting any information.
In this case, nothing in the record indicates the prison official's reasons for denying Williams' request to produce inmate Wagenman in person. There is no transcript of the hearing or notation in the record documenting the reason for relying on the witness's statement alone.
In Marshall, the First District noted:
[A]lthough under the holding in Ponte v. Real, the Department is not obligated to make its reasons for declining to call an inmate's witnesses part of the administrative record at the disciplinary hearing, the Department has nonetheless assumed that obligation by including it in its rule [Fla. Admin. Code R. 33-22.007(2)(c)].
618 So.2d at 779.
Accordingly, we reverse and remand for further proceedings. The DOC may either expunge Williams' disciplinary report and restore his gain time or it may conduct another disciplinary hearing.
Reversed and remanded.
DANAHY, A.C.J., and ALTENBERND, J., concur.
NOTES
[1]  This rule was repealed on October 1, 1995.
