
557 P.2d 1207 (1976)
Jimmy G. BAILEY, Plaintiff-Appellant,
v.
Roger CLAUSEN et al., Defendants-Appellees.
No. 27192.
Supreme Court of Colorado, En Banc.
December 20, 1976.
*1208 Ronald A. Peterson, Colorado Springs, for plaintiff-appellant.
Kane, Donley & Wills, Jerry Alan Donley, Colorado Springs, for defendants-appellees.
DAY,[*] Justice.
This appeal challenges a judgment of dismissal of a personal injury action in the district court of El Paso County. The trial court ruled that the action, brought against three deputy sheriffs of El Paso County, was barred completely by a one-year *1209 statute of limitations. C.R.S.1963, 87-1-3.[1] We reverse.
Appellant (plaintiff below) was attending a riot-control class held for police officers, deputy sheriffs, and prospective deputy sheriffs. Two of the defendants-appellees, Taylor and Schaefer, both deputy sheriffs, were acting as instructors of the class. Defendant-appellee Clausen, a deputy sheriff, was also a student. In the course of class maneuvers, a service revolver worn by Clausen fell from his person and discharged as it hit the ground, seriously injuring appellant.
To the complaint the defendants filed a written motion for dismissal on the ground that the action was barred by the statute, which reads as follows:
"One yearsheriffs' and coroners' liabilities. All actions against sheriffs and coroners upon any liability incurred by them by the doing of any act in their official capacity or by the omission of any official duty, except in relation to accounting to the county for fees earned or collected, and except for escapes, shall be brought within one year after the cause of action accrues, and not after that period."
At the hearing on the motion, no testimony was presented. Contending that the statute of limitations is an affirmative defense, appellant objected to the court procedure and argued that a plea in bar by reason of a statute of limitations cannot be raised by a motion to dismiss. It was contended that evidence was available which would remove defendants from the statutory provisions, and that such evidence could properly be presented only on trial of the issue if raised in the answer. Whereupon, the trial court made the following statement:
"Well, I really can't actually rule as to an affirmative defense on a motion to dismiss unless I treat this as a motion for summary judgment."
The court then by written order found that deputy sheriff Clausen "was acting within the scope of his duties at the time of the accident," that the statute of limitations is a complete defense to the lawsuit, and entered judgment for defendants.
We hold that it was error for the trial court to enter judgment in this action based solely upon argument of counsel on a motion to dismiss. Two other arguments are rejected but will be discussed.

I.
The appellant has persuasively argued that with the circumstances present in this case the court erred in deciding the applicability of the statute of limitations on a motion to dismiss.
It has been generally held in a number of cases that a statute of limitations, if relied upon, must be affirmatively set forth in an answer. "A plea in bar by reason of the statute of limitations cannot be raised by motion to dismiss. It is a defense which may or may not be relied upon. If relied upon it must be pleaded as an affirmative defense. . . ." Fletcher v. C. & W. Ry., 141 Colo. 72, 347 P.2d 156 (1959). See also O'Byrne v. Scofield, 120 Colo. 572, 212 P.2d 867 (1949); Smith v. Oil Co., 128 Colo. 80, 261 P.2d 149 (1953), and Knighton v. Howse, 167 Colo. 530, 448 P.2d 641 (1968). See also C.R.C.P. 12.
Appellees rely on the case of Cox v. Pearl Invest. Co., 168 Colo. 67, 450 P.2d 60 (1969). Such reliance is misplaced. Cox involved a release which had not been pled as an affirmative defense in the answer, but the merits were argued in a motion for summary judgment, without objection. We held that the objection to the court's consideration of the defense of release could not be raised for the first time in this court; that the plaintiff had not been prejudiced and that the court treated the defense as if it had been incorporated in the answer. In the case at bar, plaintiff objected to the court's consideration of the *1210 statute and urged that the issue should have been framed by answer. More importantly, prejudice to the plaintiff was demonstrated. There was no evidence before the court at the motion hearing as to the status of the deputies who were named as defendants. The record does not reflect whether they were regular or special deputies. The court ruled with no facts before it that the defendants were "acting in the scope of their employment"; but there can be a difference between "acting in the course of employment" and "acting in an official capacity." Evidence is indispensable in determining the official or non-official character of the deputies' actions at the riot-control class, both as instructors and as student. The nature of the duties of each could differ.
The statement by the court that it would treat the motion as asking for summary judgment did not meet the problem. A summary judgment is proper only where there is no genuine issue as to any material fact, which may be indicated by the pleadings, affidavits, depositions and/or admissions, and where the moving party is entitled to judgment as a matter of law. C.R. C.P. 6. Abrahamsen v. Mt'n States T & T, 177 Colo. 422, 494 P.2d 1287 (1972) and citations contained therein. This was not the posture of this case at the time the trial court entered summary judgment.

II.
Plaintiff has also challenged the statute as being unconstitutional special legislation. We find the statute valid.
The classification of occupations and professions for limitation or regulation is a matter for legislative determination. McCarty v. Goldstein, 151 Colo. 154, 376 P.2d 691 (1962). This court early upheld the validity of a provision for a one-year statute of limitations on damage suits arising out of official acts of sheriffs. In People v. Cramer, 15 Colo. 155, 25 P. 302 (1890), it was stated:
"The provision is evidently framed in the interest of the officers mentioned, and their official bondsmen. Its purpose is to prevent annoyance and injustice through the prosecution against them of stale demands predicated upon official neglect or other misconduct."
In addition to this interpretation, a caution was added:
"This purpose is eminently wise; but, in our judgment, the statute should, if possible, be so construed as that, while the persons designated are fairly protected, litigants may not be made thereby to suffer grievous and remediless wrong.
In Cramer our court sought to make equitable adjustment for the needs of all parties. Following that precedent, certain elemental determinations must be made which again point up the need to frame the issue for trial. To decide if the one-year statute of limitations applies in any situation, it must first be determined whether the officer was acting in his official capacity. This is mandated by the limited application of the statute to acts "in their [the sheriffs'] official capacity or by the omission of any official duty." We must assume that the legislature, in using the term "official," knew the distinction between official acts and acts done merely under the color of office.
In Colorado, an official act basically is one done in the actor's official capacity and under color of his office. Corder v. People, 87 Colo. 251, 287 P. 85 (1930). To the above skeletal definition, the Tenth Circuit Court of Appeals, in Whitney v. United States, 99 F.2d 327 (10th Cir. 1938), noted a necessary subjective qualification: "Official action means such as properly belongs to the office and is intended by the officer or employee to be such." We would make one further qualification, i. e., that such intent of the officer or employee must be reasonable.
A 1942 decision of the Second Circuit Court of Appeals analyzed the official acts within a short statute of limitations. In Ingo v. Koch, 127 F.2d 667 (2d Cir. 1942), three categories of conduct were set forth:
"(1) Conduct which is lawful and not-actionable, because entirely within *1211 sheriff's official authority, (2) unlawful conduct, actionable, but sufficiently close to being `official' so that suit is barred if not brought within one year, (3) unlawful conduct, so far from being `official' that, for purpose of limitations, it is treated like that of an ordinary non-official person."
Thus, in order to classify an act as official and protected by the statute of limitations, or non-official and clearly outside of the duties of an office (personal act), one must first consider the type of activity involved, and then consider the intent, purpose, and knowledge of the actor. Each case must be decided on the factual situation involved therein.

III.
Plaintiff also contended the statute has no application because the defendants were not sheriffs protected by the limitation.
We hold the term "sheriff" is used in its generic sense and includes the whole class of officers performing the duties of the office of sheriff. Thus, there is no merit in appellant's argument that to include deputy sheriffs within the statute's protection impermissibly extends its coverage.
A deputy sheriff is one appointed to act for the sheriff.
"Each [officer] may appoint as many deputies as he may think proper. . . . Persons may also be deputized by such sheriff . . . to do particular acts. . . ." C.R.S.1963, 35-5-5.[2] The judgment is reversed and the cause remanded to the district court for further proceedings consonant with the views expressed herein.
PRINGLE, C. J., concurs as to points I and II and dissents as to point III.
ERICKSON, J., concurs as to point I and dissents as to point II and III.
NOTES
[*]  Retired Supreme Court Justice sitting under assignment of the Chief Justice under provisions of article VI, section 5(3) of the constitution of Colorado.
[1]  Now section 13-80-103, C.R.S.1973.
[2]  Now section 30-10-506, C.R.S.1973.
