
574 So.2d 218 (1991)
STATE of Florida, Appellant,
v.
Jerry Lee SLAUGHTER, Appellee.
No. 90-1620.
District Court of Appeal of Florida, First District.
January 23, 1991.
*219 Robert A. Butterworth, Atty. Gen., and Virlindia Doss, Asst. Atty. Gen., Tallahassee, for appellant.
Barbara M. Linthicum, Public Defender and David A. Davis, Asst. Public Defender, Tallahassee, for appellee.
JOANOS, Judge.
The state appeals an order dismissing with prejudice an information charging that appellee unlawfully threatened unlawful harm to a public servant, to wit: a circuit judge, with the intent to influence said public servant in the performance of his public duty in violation of section 838.021, Florida Statutes. The issue presented is whether section 838.021(3)(b), Florida Statutes (1989), is unconstitutional because it impermissibly creates a class of protected governmental servants who are protected from threats which have no relation to their official duties. We conclude that the statute is not unconstitutional, and reverse the ruling of the trial court.
The challenged statute, section 838.021, Florida Statutes (1989), provides:
838.021 Corruption by threat against public servant. 
(1) Whoever unlawfully harms or threatens unlawful harm to any public servant, to his immediate family, or to any other person with whose welfare he is interested, with the intent or purpose:
(a) To influence the performance of any act or omission which the person believes to be, or the public servant represents as being, within the official discretion of the public servant, in violation of a public duty, or in performance of a public duty.
(b) To cause or induce him to use or exert, or procure the use or exertion of, any influence upon or with any other public servant regarding any act or omission which the person believes to be, or the public servant represents as being, within the official discretion of the public servant, in violation of a public duty, or in performance of a public duty.
(2) Prosecution under this section shall not require any allegation or proof that the public servant ultimately sought to be unlawfully influenced was qualified to act in the desired way, that he had assumed office, that the matter was properly pending before him or might by law properly be brought before him, that he possessed jurisdiction over the matter, or that his official action was necessary to achieve the person's purpose.
(3)(a) Whoever unlawfully harms any public servant or any other person with whose welfare he is interested shall be guilty of a felony of the second degree, punishable as provided in s. 775.082, s. 775.083, or s. 775.084.
(b) Whoever threatens unlawful harm to any public servant or to any other person with whose welfare he is interested shall be guilty of a felony of the third degree, punishable as provided in s. 775.082, s. 775.083, or s. 775.084.
At the outset, an exception to the rule that a trial court's judgment is presumptively valid occurs when an appellate court is called upon to pass upon a statute which the trial court has declared unconstitutional. *220 In such circumstances, the statute, rather than the trial court's ruling, is favored with a presumption of validity. In Re Estate of Caldwell, 247 So.2d 1, 3 (Fla. 1971). That is, all reasonable doubts as to the validity of statutes under the Constitution are to be resolved in favor of constitutionality. Id. Accord State, Department of Legal Affairs v. Sanford-Orlando Kennel Club, Inc., 411 So.2d 1012, 1015 (Fla. 5th DCA 1982), reversed on other grounds, 434 So.2d 879 (Fla. 1983).
In construing statutes, legislative intent is the key. "The primary rule of construction is to ascertain and give effect to that intent." City of Boca Raton v. Gidman, 440 So.2d 1277, 1281 (Fla. 1983); Parker v. State, 406 So.2d 1089, 1092 (Fla. 1981). One indicator of legislative intent is the title of the statute. Parker, 406 So.2d at 1092. If the language of a statute is ambiguous, the court must determine legislative intent from a consideration of the act as a whole. Id. Further, when it is reasonably possible and consistent with legislative intent to do so, the court must give preference to a construction which would give effect to the statute over a construction which would defeat it. Schultz v. State, 361 So.2d 416, 419 (Fla. 1978).
The test to be used in determining whether a statutory classification satisfies the Equal Protection Clause is whether the classification rests on some difference bearing a reasonable relation to the object of the legislation. Soverino v. State, 356 So.2d 269 (Fla. 1978). Soverino concerned an equal protection challenge to section 784.07, which enhances the sanction for battery when the battery is upon a law enforcement officer or firefighter rather than upon a person not a member of that class. In Soverino, the court found that section 784.07 is constitutional, since it reclassified the offense only if the law enforcement officer or firefighter is engaged in the lawful performance of his duties. In this vein, the statute was deemed reasonably related to the legislative purpose of affording greater protection to the officer or firefighter when the officer or firefighter was engaged in protecting the public welfare.
In the instant case, the trial court found that section 838.021(3)(b) is in violation of the Equal Protection Clause, based on the view that the statute does not relate the proscribed threats to a public servant to the performance of any lawful governmental duty. We disagree. The order under review indicates that the trial court's analysis encompassed comparisons and analogies to statutes having a similar purpose, but the trial court did not resort to general rules of statutory construction. Application of principles of statutory construction to section 838.021 indicates that, contrary to the trial court's view, the statute properly relates the proscribed threats to public servants to an intent to influence or affect the performance of the public servant's duties. See, generally, Smith v. State, 532 So.2d 50, 52 (Fla. 2d DCA 1988).
Although the manner in which the statute is phrased and punctuated impairs its clarity, legislative intent can be gleaned from a reading of the statute as a whole, particularly by considering subsection (1) together with subsection (3). Subsection (1) defines the proscribed offense. Subsection (3) sets forth the penalties for violation of subsection (1), and "is designed to protect public officials in the discharge of their duties without unlawful intimidation." Smith, 532 So.2d at 52. When read together, these provisions evince legislative intent to protect public servants from coercion or unlawful influence in the performance of a discretionary public duty. See Bragg v. State, 475 So.2d 1255 (Fla. 5th DCA 1985). See generally Pangano v. State, 387 So.2d 349, 350 (Fla. 1980). In construing the statutory provision here under review, the fifth district implicitly found that the statute properly related the proscribed threats to the performance of a public duty when it stated: "The elements of the crime require proof of threat of unlawful harm to a public servant to influence the person threatened to do, or not do, some discretionary act." Bragg, 475 So.2d at 1257. See also Smith, 532 So.2d at 52. Because the statute reasonably relates the proscription against harm or threat of harm to a public *221 official to that official's performance of his public duties, it does not violate equal protection principles.
Accordingly, the order dismissing the information filed against appellee with prejudice is reversed, and the matter is remanded for further proceedings.
BARFIELD and WOLF, JJ., concur.
