
984 S.W.2d 955 (1998)
Lawtis Donald RHODEN, Petitioner/Appellant,
v.
STATE DEPARTMENT OF CORRECTION, Respondent/Appellee.
Court of Appeals of Tennessee, at Nashville.
October 14, 1998.
Permission to Appeal Denied January 25, 1999.
Gary L. Anderson, University of Tennessee Legal Clinic, Knoxville, Tennessee, Attorney for Petitioner/Appellant.
John Knox Walkup, Attorney General and Reporter, John R. Miles, Attorney General and Reporter, North Nashville, Tennessee, Attorney for Respondent/Appellee.
Permission to Appeal Denied by Supreme Court January 25, 1999.


*956 OPINION

CANTRELL, Judge.
An inmate in the correction department sought a declaratory judgment concerning his sentence credits. The Chancery Court of Davidson County dismissed the petition (1) because the proper avenue for relief was a writ of certiorari to challenge the disciplinary action that caused the loss of his sentence credits, and (2) because the failure to give him sentence credits while he was under a California detainer did not violate his equal protection rights. We affirm.[1]

I.
Lawtis Donald Rhoden received a twenty year sentence for rape in 1985. In August of 1995, while Mr. Rhoden was an inmate at the Turney Center, correction officers confiscated seven pamphlets which he had received through the mail from an organization advocating racial purity. Mr. Rhoden alleges that the written material does not advocate violence or other illegal activity and is not so racially inflammatory that it would likely cause violence within the prison.
The Turney Center Disciplinary Board found Mr. Rhoden guilty of possessing the literature, sentenced him to ten days in punitive segregation and recommended his placement in administrative segregation, maximum security status. Following the Department's appeal procedures, the prison warden approved the Board's recommendation and the Commissioner of Correction signed off on the punishment on September 6, 1995.
While in maximum security Mr. Rhoden could not earn the sixteen days credit he had been earning each month. In February of 1996 and April of 1997, Mr. Rhoden's security status was reduced in steps back to minimum security, but he lost sentence credits in each step by not being able to earn the maximum credits available if he had been in minimum security. He alleges that in all he lost seven months of credits for the possession of constitutionally protected materials.
In the meantime, in August of 1996, Mr. Rhoden filed a petition for a declaratory order with the Department of Correction seeking a return of the sentence credits lost as a result of the disciplinary proceeding. The Department denied the petition in a letter dated August 27, 1996.
On October 25, 1996, Mr. Rhoden filed a petition for review in the Chancery Court of Davidson County challenging the loss of his sentence credits. The petition recited that it was filed pursuant to Tenn.Code Ann. § 4-5-322.[2] The Department of Correction filed a motion to dismiss on the grounds that the court lacked jurisdiction over the subject matter and that the petition failed to state a cause of action. The court dismissed the petition because it was essentially an action challenging the results of the disciplinary proceeding and a review of that proceeding should have been sought within sixty days by a petition for the common law writ of certiorari.

II.
A prisoner disciplinary proceeding cannot be reviewed directly under the Uniform Administrative Procedures Act because the Act removes such proceedings from the definition of a contested case. Tenn.Code Ann. § 4-5-106(b). The proper vehicle for challenging a disciplinary action is a petition for a common law writ of certiorari, and the petition must be filed within sixty days of the challenged action. Bishop v. Conley, 894 S.W.2d 294 (Tenn.Cr.App.1994). See Tenn.Code Ann. § 27-9-102.
Mr. Rhoden alleges, however, that he is not seeking a review of the disciplinary proceedings. *957 Instead he "is attacking the unlawful actions of the T.D.O.C.; and the Commissioner of the T.D.O.C. in punishing him for mere possession of constitutionally protected literature." We fail to see the distinction. But giving him the benefit of the doubt, the proper procedure for attacking a rule of the Department is set out in Tenn.Code Ann. § 4-5-223.
Tenn.Code Ann. § 4-5-223(a) of the UAPA allows any person affected by a state statute or an order or rule of a state agency to petition the agency for a declaratory order as to the validity or applicability of the rule, statute, or order. The agency can then (1) convene a contested case hearing and issue the declaratory order, Tenn.Code Ann. § 4-5-323(a)(1), or (2) refuse to issue the order, Tenn.Code Ann. § 4-5-223(a)(2). In cases where the agency refuses to issue the declaratory order, the affected person may seek a declaratory judgment in the Chancery Court of Davidson County. Tenn.Code Ann. § 4-5-224(a).
Mr. Rhoden's petition does not state a claim for a declaratory judgment under the UAPA. He is not challenging a statute or an agency rule or orderexcept the order resulting from the disciplinary proceeding. In effect he is challenging the factual conclusion arrived at during the disciplinary proceeding that the literature found in his possession violated the Department's rules. That determination should have been reviewed by a direct review of the disciplinary proceeding.
This case can be distinguished from Gilbreth v. Bradley, 01-A-01-9402-CH-00083, 1994 WL 514163 (Nashville, September 21, 1994), in which the inmate did seek a declaratory judgment concerning the application of a statute to inmates sentenced under prior law. The issue in Gilbreth was not whether the prisoner should have been disciplined but whether the punishment imposed by the Department exceeded its authority under the statute in question.
The judgment of the trial court is affirmed and the cause is remanded to the Chancery Court of Davidson County for any further proceedings necessary. Tax the costs on appeal to the appellant.
HENRY F. TODD, Presiding Judge, Middle Section, WILLIAM C. KOCH, JR., Judge, concur.
NOTES
[1]  The question of the effect of the California detainer on the petitioner's rights was not argued on appeal, so we do not deal with it in this opinion.
[2]  Tenn.Code Ann. § 4-5-322 provides for a review of a contested case. A petition for a declaratory judgment, after an agency has refused a declaratory order, is authorized by Tenn.Code Ann. § 4-5-225. For this reason alone the petitioner failed to state a cause of action.
