
380 So.2d 797 (1980)
Philip HALES et al.
v.
FIRST NATIONAL BANK OF MOBILE.
78-673.
Supreme Court of Alabama.
February 22, 1980.
Roger Killian, Fort Payne, for appellants.
F. Michael Haney, of Inzer, Suttle, Swann & Stivender, Gadsden, for appellee.
PER CURIAM.
This action was initiated by plaintiff First National Bank of Mobile (the Bank) filing a two count complaint alleging a deficiency arising from a foreclosure sale and the right to possession of certain personal property under a security agreement. Defendants Philip and Dorothy Hales appeal from the grant of summary judgment in *798 favor of the Bank on their amended counterclaim which alleged, inter alia, fraud, misrepresentation, and breach of fiduciary duty by the Bank. We reverse.

Issue
Whether the trial court erred to reversal in converting, sua sponte, the Bank's motion to dismiss pursuant to Rule 12(b)(6), ARCP, to a motion for summary judgment when the trial court gave no notice of the changed status of the motion to the Haleses prior to entry of summary judgment.

Facts
As mentioned earlier, this suit was initiated by the Bank. When it filed its complaint, the Bank also filed a motion for writ of seizure of certain equipment; the motion was granted after a hearing at which testimony and other evidence was taken. The only evidence contained in the record resulted from this hearing. At the hearing, the evidence was limited to the issue of whether the writ should be granted.
On 9 January 1979 the Haleses filed an answer and counterclaim to the Bank's complaint. The Bank filed a Rule 12(b)(6), ARCP, motion to dismiss the counterclaim which was apparently granted. On 4 April 1979 the Haleses filed an amended counterclaim that alleged: (1) false representations were made by the Bank to the Haleses on 5 April 1978; (2) the Bank breached an agreement entered into on 5 April 1978 with the Haleses by permitting certain assigned contract rights to go in default; and (3) a breach of fiduciary duty owed by the Bank to the Haleses. The Bank filed a second motion to dismiss this amended counterclaim alleging Rule 12(b)(6) grounds together with the ground that the subject of the counterclaim was res judicata.[1]
On 29 May 1979 a hearing was held concerning the Bank's motion to dismiss the Haleses' amended counterclaim. A notation dated 29 May 1979 was made by the trial court on the Bank's motion which stated:
"May 29, 1979
Motion granted.
Counterclaim is dismissed.
                    W. G. Hawkins
                    Judge"
On 5 June 1979, without prior notice to the Haleses, a judgment was entered which reads as follows:
"This cause coming on to be heard on motion to dismiss filed by Plaintiff as to the counterclaim filed by the defendants, and same having been considered and treated by the Court as a motion for summary judgment in accordance with the Alabama Rules of Civil Procedure, and after due consideration of the pleadings, oral argument of counsel, documented evidence submitted by the parties, and the hearing in this cause on May 29, 1979, it is the opinion of this Court that the motion is due to be granted.
"WHEREFORE, it is ORDERED, ADJUDGED AND DECREED that the motion to dismiss and treated by the Court as a motion for summary judgment of Plaintiff, First National Bank of Mobile, a national banking association, as to the counterclaim of Defendants, Philip Hales and wife, Dorothy Hales, be, and same is hereby granted. There appearing no just reason or cause for delay in the entry of such order, it is further ORDERED that final summary judgment be, and hereby is, granted in favor of the Plaintiff, First National Bank of Mobile, a national banking association, and against the counterclaim of Defendants, Philip Hales and wife, Dorothy Hales, and the aforesaid Plaintiff be, and it is hereby finally dismissed from the said counterclaim of the Defendants.
  "DONE AND ORDERED this the 5th
 day of June, 1979.
     "s/W. G. Hawkins, Circuit Judge"
This appeal followed.

Decision
The Haleses contend the trial court committed reversible error by converting, on its *799 own initiative, the Bank's motion for dismissal on Rule 12(b)(6) grounds[2] to a motion for summary judgment, after the hearing on the motion had already been conducted, because it deprived them of an opportunity to present affidavits and other evidence in opposition.
Rule 12(b), ARCP, states in pertinent part:
"* * * If, on a motion asserting the defense numbered (6) to dismiss for failure of the pleading to state a claim upon which relief can be granted, matters outside the pleading are presented to and not excluded by the court, the motion shall be treated as one for summary judgment and disposed of as provided in Rule 56, and all parties shall be given reasonable opportunity to present all material made pertinent to such a motion by Rule 56." (Emphasis added.)
Rule 56(c), ARCP, states in pertinent part:
"(c) Motion and Proceedings Thereon. The motion shall be served at least 10 days before the time fixed for the hearing. The adverse party prior to the day of hearing may serve opposing affidavits. * * *"
It is clear from the above quoted portions of Rules 12 and 56 that: if a motion under Rule 12(b)(6) is converted into a motion for summary judgment, both parties shall be given a reasonable opportunity to submit affidavits and other extraneous proofs to avoid a party being taken by surprise through conversion of the motion to dismiss to one for summary judgment. Davis v. Howard, 561 F.2d 565 (5th Cir. 1977); Moore's Federal Practice, Vol. 2A, ¶ 12.09(3), N. 25. It is also clear that the spirit of Rule 56 requires the same notice and hearing where the court contemplates summary judgment on its own initiative as it does when a party moves for summary judgment; i. e., ten days notice. See Davis v. Howard, supra; Georgia Southern & F. Ry. Co. v. Atlantic Coast Line R. Co., 373 F.2d 493 (5th Cir. 1967); Bowdidge v. Lehman, 252 F.2d 366 (6th Cir. 1958). The entry of summary judgment by a trial court, sua sponte, without giving to the party against whom such judgment is entered adequate and reasonable notice, as well as an opportunity to present evidence in opposition, is prejudicial error requiring reversal. Id.
We agree with the following statement made by the United States Court of Appeals for the Fifth Circuit in its per curiam opinion in Davis v. Howard, supra:
"We do not hold that a notice to convert a 12(b)(6) motion into a summary judgment must be by written order, but the record must adequately demonstrate that all counsel were aware of the intentions of the district judge to treat the motion as converted, together with a reasonable opportunity afforded to the non-moving party to present, by way of affidavit or otherwise, anything necessary to rebut the contention of the moving party. This does not appear in the instant case, although the district judge may have verbally advised counsel to this effect, all of which is not revealed in the record.
"Today we hold that where matters outside the pleadings are considered in disposition of a Rule 12(b)(6) motion, so as to automatically convert it to one for summary judgment pursuant to Rule 56, or as one made sua sponte, the Rule 56 strictures of notice, hearing and admissibility into evidence are strictly required. As Judge Goldberg aptly observed of the notice requirement in Soley v. Star & Herald Co., 390 F.2d 364, 369-70 (5 Cir. 1968): `They [the litigants] cannot read over the judge's shoulder, or penetrate his memory. Nor can we. From Shakespeare's Hamlet to Albee's Tiny Alice, soliloquies and asides have been shared with the audience.' Where there is a motion to dismiss for failure to state a claim upon which relief may be granted, there can never be a wide overview by the trial court, beyond the pleadings to include matters outside, without affording *800 all litigants the opportunity to offer their perspectives on the additional matter by way of admissible evidence.
"The bridling devices at issue here sustain and insure the most elementary operation of our civil law. The concepts of notice, admissibility, and opportunity to be heard are ancient primaries. Independent from these notions in advocacy, there is the trial court's duty to insure that its basis for judgment is without error. This duty of the trial court distinguishes the margin of allowances we have held in the instance of an original Rule 56 motion from summary disposition following a Rule 12(b)(6) motion. * * * However correct the conclusion below may be in the end, we cannot allow the shaving of principles for expediency when those precepts assure order and justice." 561 F.2d at 571, 572.
In this case the Haleses were given no notice concerning the trial court's decision to change the Bank's motion to dismiss into a motion for summary judgment. In fact, it appears from the record the trial court made this change after the hearing on the motion to dismiss had been conducted and after indicating it would grant the motion to dismiss. This was clearly error which was prejudicial to the Haleses since affidavits and other evidence can and should, be introduced in opposition to a motion for summary judgment to demonstrate that issues of material fact exist, if that be the case; conversely, a 12(b)(6) motion to dismiss only encompasses the determination of whether the pleading states a claim upon which relief can be granted. Matters outside the pleadings should never be considered in deciding whether to grant a 12(b)(6) motion.
In reaching our decision in this case, we are not deciding whether summary judgment would be proper as to the Haleses' counterclaim. We are only deciding they were denied procedural rights afforded them under ARCP. The Bank is free to file a motion for summary judgment, and the trial court is free to conduct a proper hearing affording to all parties proper notice and the opportunity to present evidence as allowed by Rule 56, to determine whether any genuine issue of material fact is present in the case.
The judgment is hereby reversed, for the reasons set forth, and the case remanded for further proceedings not inconsistent with this opinion.
REVERSED AND REMANDED.
TORBERT, C. J., and FAULKNER, ALMON, EMBRY and BEATTY, JJ., concur.
NOTES
[1]  The Bank asserted the granting of the prior motion to dismiss was res judicata since both counterclaims involved the same subject matter.
[2]  We refer to the motion to dismiss as a 12(b)(6) motion since 12(b)(6) grounds were alleged and the res judicata allegations were totally without merit.
