943 F.2d 259
Herbert THOMAS, Plaintiff-Appellant,v.Charles SCULLY, Superintendent of Green Haven CF, andCentral Office Review Committee, State of New YorkDepartment of Corrections, Defendants-Appellees.
No. 123, Docket 90-2459.
United States Court of Appeals,Second Circuit.
Argued Sept. 12, 1991.Decided Sept. 16, 1991.

Charles F. Lacina, New York City, for plaintiff-appellant.
Before KEARSE, MINER and McLAUGHLIN, Circuit Judges.
PER CURIAM:


1
Plaintiff Herbert Thomas, a New York State prisoner, appeals from a final judgment of the United States District Court for the Southern District of New York, Charles L. Brieant, Chief Judge, dismissing his pro se complaint which contended that his rights under the First Amendment to the Constitution were violated by a policy promulgated by defendant Charles Scully, Superintendent of Green Haven Correctional Facility, prohibiting inmates from possessing noncommercial nude photographs.   Thomas complained that prison officials, pursuant to that policy, confiscated nude photographs mailed to him by his girlfriend and returned them to the sender.   The district court, sua sponte, dismissed the complaint pursuant to Fed.R.Civ.P. 12(b)(6) and 28 U.S.C. § 1915(d) (1988) on the ground that the regulation was rationally related to the goal of maintaining prison security, and thus Thomas's claim did not rise to the level of a constitutional violation.   On appeal, now represented by appointed counsel, Thomas contends that the court erred (1) in ruling on the complaint without giving him an opportunity to be heard, and (2) in concluding that the challenged regulation was permissible.   For the reasons below, we agree with the procedural contention and remand for further consideration of the merits.


2
Though the district court has the power to dismiss a complaint sua sponte for failure to state a claim on which relief can be granted, it may not properly do so without giving the plaintiff an opportunity to be heard.   See, e.g., Perez v. Ortiz, 849 F.2d 793, 797 (2d Cir.1988);  5A C. Wright & A. Miller, Federal Practice and Procedure § 1357, at 301 (1990) ("court on its own initiative may note the inadequacy of the complaint and dismiss it for failure to state a claim as long as the procedure employed is fair").   Section 1915(d) gives the court the power to dismiss a pro se complaint sua sponte if the complaint is frivolous.   A complaint may fail to state a claim on which relief may be granted without being frivolous.  Neitzke v. Williams, 490 U.S. 319, 109 S.Ct. 1827, 1832, 104 L.Ed.2d 338 (1989).


3
There is no suggestion in the decision of the district court that the complaint in the present case was frivolous, and we conclude that it was not frivolous.   Thus dismissal pursuant to § 1915(d) was inappropriate.   We also conclude that the dismissal pursuant to Rule 12(b)(6) was inappropriate, both because it was sua sponte and thus gave Thomas no opportunity to defend the complaint, and because, whatever its merit, the complaint did state a claim on which relief could be granted.   The district court's rationale that the regulation adopted by the defendant was reasonable and valid went beyond the face of the complaint and addressed the merits of the case.


4
Accordingly, we vacate the judgment of dismissal and remand to the district court for proceedings addressing the merits of Thomas's complaint.   We suggest that the district court continue the appointment of counsel for Thomas in connection with those further proceedings.


5
No costs.

