
34 P.3d 1096 (2001)
136 Idaho 413
STATE of Idaho, Plaintiff-Respondent,
v.
Kathleen TADLOCK, Defendant-Appellant.
No. 26063.
Court of Appeals of Idaho.
August 27, 2001.
Review Denied November 27, 2001.
Ronaldo A. Coulter, State Appellate Public Defender; Sara B. Thomas, Deputy Appellate Public Defender, Boise, for appellant.
*1097 Hon. Alan G. Lance, Attorney General; Kenneth K. Jorgensen, Deputy Attorney General, Boise, for respondent.
LANSING, Judge.
Kathleen Tadlock appeals from the judgment of conviction entered after a jury found her guilty of felony possession of marijuana with the intent to deliver, Idaho Code § 37-2732(a)(1)(B). On appeal, Tadlock asserts that the district court erred by not instructing the jury regarding the common law necessity defense. Tadlock also asserts that the district court violated her First Amendment right to free speech when, at the sentencing hearing, it considered her prior political advocacy of legalizing marijuana. Finally, Tadlock asserts that her sentence is excessive.

FACTS AND PROCEDURAL HISTORY
Executing a warrant, police officers searched Tadlock's house and discovered 260 grams of marijuana, $5,000 in cash, a pair of finger scales and a notebook containing notations of weights and dollar amounts. Tadlock was charged with felony possession of marijuana with the intent to deliver, I.C. § 37-2732(a)(1)(B). At trial, Tadlock presented testimony that she used marijuana to alleviate pain she suffers from a number of ailments including osteoporosis, hyperparathyroidism, depression, hip and knee pain, endometrial-hyperplasia, uterine fibroid, and back pain. She testified that although she was prescribed medications, including pain relievers, for these ailments, she found the medications difficult to take because they are in pill form and she has difficulty swallowing pills. According to Tadlock's testimony, she used just enough marijuana to relieve her pain and allow her to function. Tadlock requested that the jury be instructed on the medical necessity defense or, alternatively, the general common law necessity defense. The district court declined to give either instruction because, in the court's view, there was insufficient evidence to meet the elements of those defenses. In particular, the district court noted an absence of evidence that Tadlock lacked adequate legal medical alternatives to the use of marijuana.
The jury was instructed on the elements of the charged offense, possession of marijuana with intent to deliver, and also on the lesser included offense of simple possession. The jury returned a verdict finding Tadlock guilty of possession of marijuana with the intent to deliver. The district court thereafter imposed a unified sentence of five years with one year determinate.

ANALYSIS

A. Necessity Defense Jury Instruction
As her first issue on appeal, Tadlock challenges the district court's denial of her request for a necessity defense instruction. The question whether a jury was properly instructed is one of law over which this Court exercises free review. State v. Buckley, 131 Idaho 179, 182, 953 P.2d 619, 622 (Ct.App.1997), aff'd, 131 Idaho 164, 953 P.2d 604 (1998). On appeal, jury instructions are viewed as a whole, not individually, to determine whether the jury was properly and adequately instructed on the applicable law. State v. Rozajewski, 130 Idaho 644, 646, 945 P.2d 1390, 1392 (Ct.App.1997). A defendant in a criminal action is entitled to have his legal theory of defense submitted to the jury through an instruction if there is a reasonable view of the evidence that would support the theory. State v. Howley, 128 Idaho 874, 878-79, 920 P.2d 391, 395-96 (1996); State v. Johns, 112 Idaho 873, 880-81, 736 P.2d 1327, 1334-35 (1987); State v. Arrasmith, 132 Idaho 33, 43, 966 P.2d 33, 43 (Ct.App.1998).
The necessity defense is based on the premise that "a person who is compelled to commit an illegal act in order to prevent a greater harm should not be punished for that act." State v. Hastings, 118 Idaho 854, 855, 801 P.2d 563, 564 (1990). The elements of the defense are: (1) a specific threat of immediate harm; (2) the circumstances which necessitate the illegal act must not have been brought about by the defendant; (3) the same objective could not have been accomplished by a less offensive alternative available to the actor; and (4) the harm caused was not disproportionate to the harm avoided. State v. Kopsa, 126 Idaho 512, 520, 887 P.2d 57, 65 (Ct.App.1994); Idaho Criminal Jury Instruction 1512. When the defense of necessity has been demonstrated, "it justifies *1098 the defendant's conduct in violating the literal language of the criminal law and so the defendant is not guilty of the crime in question." 1 WAYNE R. LAFAVE & AUSTIN W. SCOTT, JR., SUBSTANTIVE CRIMINAL LAW § 5.4 at 630.
Tadlock argues that she presented sufficient evidence from which a jury could have found all the elements of the necessity defense. She relies upon Hastings, where the Idaho Supreme Court held that although medical necessity is not a recognized defense in Idaho, the common law necessity defense may be invoked. The Court held in Hastings that a defendant who claimed to use marijuana to combat pain and muscle spasms from rheumatoid arthritis was entitled to have the jury instructed on the necessity defense.
We conclude that it is unnecessary to determine whether the evidence was sufficient in Tadlock's case for presentation of the necessity defense, for even if the district court erred in failing to instruct the jury on this defense, the error was harmless. This is so because the necessity defense could have applied only to simple possession of marijuana, which was the lesser included offense on which the jury was instructed. The defense cannot logically apply to the charged offense of which Tadlock was found guilty, possession of marijuana with intent to deliver. Admittedly, Tadlock's evidence of medical need may have been relevant to controvert the mens rea element of intent to deliver by showing that Tadlock possessed the drug only for her own personal use. However, medical necessity could not be a viable justification for possession with intent to deliver because Tadlock's own medical need for marijuana could not justify her possession of the drug with the intent to deliver it to others. Only if the jury had first acquitted Tadlock of the intent to deliver charge and considered the lesser included offense of simple possession would the necessity instruction have been applicable. Because the jury found Tadlock guilty of possession with the intent to deliver, any error in the denial of her requested jury instruction on common law necessity was harmless.

B. Sentence

1. First Amendment
Tadlock next asserts that the district court violated her right of free speech under the First Amendment to the United States Constitution and Article I, § 9 of the Idaho Constitution when it considered her public advocacy of legalization of marijuana as a factor that weighed against placing her on probation. In a supplement to the presentence investigation report (PSI), the State submitted printouts of Tadlock's web page, which expressed her belief that marijuana should be legalized for medicinal purposes. Tadlock's attorney objected to the inclusion of this information and moved to strike it from the PSI, but the district court denied the motion, concluding that Tadlock's attitude about the use and sale of marijuana was relevant to the court's determination whether she should be placed on probation. In explaining his decision not to grant probation, the district judge stated, "I don't believe that probation is going to be successful, for the same facts that I've previously mentioned; that you're likely to continue to use marijuana, based upon your belief that it's helpful to you medically, and that it should be legalized." Tadlock contends that the court's decision not to grant probation, based in part upon her advocacy of the legalization of marijuana, constituted an unconstitutional imposition of punishment for her exercise of free speech.
We are not persuaded that a constitutional violation occurred here. Decisions of the United States Supreme Court provide guidance on this issue. In Barclay v. Florida, 463 U.S. 939, 103 S.Ct. 3418, 77 L.Ed.2d 1134 (1983), a plurality of the Court held that the defendant's racial motive for a murder (as indicated by his membership in the Black Liberation Army, which advocated indiscriminate killing of white people and the initiation of a race war) was properly considered by the sentencing court because it was relevant to several statutory aggravating factors in sentencing. Id. at 949-50, 103 S.Ct. at 3424-25, 77 L.Ed.2d at 1143-44. By contrast, in Dawson v. Delaware, 503 U.S. 159, 112 S.Ct. 1093, 117 L.Ed.2d 309 (1992), the Supreme Court said that the First Amendment prevents *1099 a state "from employing evidence of a defendant's abstract beliefs at a sentencing hearing when those beliefs have no bearing on the issue being tried." Id. at 168, 112 S.Ct. at 1099, 117 L.Ed.2d at 319. The Court held that the admission at sentencing of a stipulation, offered in lieu of presentation of evidence, that the defendant was a member of the Aryan Brotherhood, was improper, but only because "the narrowness of the stipulation left the Aryan Brotherhood evidence totally without relevance to Dawson's sentencing proceeding." Id. at 165, 112 S.Ct. at 1097, 117 L.Ed.2d at 317. The Court noted that if admissible evidence had been presented that the Aryan Brotherhood is a white racist prison gang that is associated with drugs and violent escape attempts and that advocates murder of fellow inmates, "we would have a much different case." Id. The Court continued:
Because the prosecution did not prove that the Aryan Brotherhood had committed any unlawful or violent acts, or had even endorsed such acts, the Aryan Brotherhood evidence was . . . not relevant to help prove any aggravating circumstance. In many cases, for example, associational evidence might serve a legitimate purpose in showing that a defendant represents a future danger to society. A defendant's membership in an organization that endorses the killing of any identifiable group, for example, might be relevant to a jury's inquiry into whether the defendant will be dangerous in the future. Other evidence concerning a defendant's associations might be relevant in proving other aggravating circumstances.
Id. at 166, 112 S.Ct. at 1098, 117 L.Ed.2d at 318. (Emphasis added.)
Unlike the situation in Dawson, the information regarding Tadlock's expressions of political views on the legalization and use of marijuana was relevant to the sentencing decision, for it bore upon the likelihood that she would repeat her crime. This relevance was appropriately explained by the district court:
[Idaho Criminal] Rule 32 provides for the court to consider a broad range of information. In that also includes the psychological and mental makeup of the defendant. I interpret the rule to provide to the court information regarding the defendant's ability or likelihood that you might do a successful probation.
. . . .
I am cognizant, as pointed out, that her expressions of theher support or activism for legalizing marijuana is an expression of her free speech right; [but] it is also an expression of her belief about the use and the likelihood of heror not of her using marijuana in the future after sentencing by this court.
The district court was careful to explain that Tadlock was not being punished for her expressions or belief about the legalization of marijuana:
Now, as far as the sentence itself is concerned, Ms. Tadlock, the court has heard a lot and you put forth a lot of testimony at the trial and during the sentencing proceedings about the legalization and the use of marijuana. I know you have strong beliefs in that respect. And in my view, this trial was not about your beliefs on the legalization of marijuana. I do not believe that it would be appropriate to try you for your beliefs. That is your right to express those views. It is also your right to follow thea legal process to obtain legalization of that drug in this state. It's been done in other states, as you know, like in California and Arizona, they passed those. But until such time as that happens and you follow those legal procedures, or the legislature determines in this state that it's going to be allowed, you have the obligation, like everybody else in this room and this county, to follow the laws as established by the legislature, whether we agree with them or not.
. . . .
And I say this to assure you that although I disagree with your ideas about the legalization of marijuana, I do not disagree with your right to express those opinions. And the sentence that I will be imposing is not for your views. You're being sentenced for the actions that you were convicted of by a jury in this county; that is possession with the intent to deliver.
*1100 The record demonstrates that the district court also took multiple other factors into consideration when crafting Tadlock's sentence. Furthermore, the sentencing transcript and the PSI disclose that Tadlock herself introduced much information, including her own statement in allocution, regarding her political view on the legalization of marijuana. After having done so, it is inconsistent for Tadlock to now complain on appeal that the district court erred by considering evidence, the subject matter of which she herself presented. We conclude that the district court did not violate Tadlock's First Amendment rights by considering the information on Tadlock's website as the court evaluated the likelihood that Tadlock would obey the law if placed on probation.

2. Excessive sentence
Finally, we consider Tadlock's contention that her sentence is excessive. Our standards for appellate review of a sentence are well settled. When a sentence is imposed within the maximum permitted for the offense, we review the sentence for an abuse of discretion. State v. Toohill, 103 Idaho 565, 650 P.2d 707 (Ct.App.1982). If the sentence is not illegal, the appellant has the burden to show that it is unreasonable, and thus a clear abuse of discretion. State v. Brown, 121 Idaho 385, 393, 825 P.2d 482, 490 (1992). A sentence may represent such an abuse if it is shown to be unreasonable upon the facts of the case. State v. Nice, 103 Idaho 89, 645 P.2d 323 (1982). A sentence of confinement is reasonable if it appears that the confinement is necessary "to accomplish the primary objective of protecting society and to achieve any or all of the related goals of deterrence, rehabilitation or retribution applicable to a given case." Toohill, supra.
As indicated above, the district court took multiple factors into consideration when sentencing Tadlock. Among these factors were the likelihood she would commit more crimes, whether correctional treatment is necessary, deterrence effect, the protection of society, and Tadlock's lack of remorse and denial that she committed a crime. The district court also took into consideration Tadlock's minimal prior criminal record. The issue presented to this Court is not whether the sentence is one that we would have imposed, but whether the sentence is plainly excessive under any reasonable view of the facts. State v. Burdett, 134 Idaho 271, 279, 1 P.3d 299, 307 (Ct.App.2000). If reasonable minds might differ as to whether the sentence is excessive, this Court is not free to substitute its view for that of the trial court. Having examined the PSI and the transcript from the sentencing hearing, we conclude that the district court acted within its discretion when it imposed upon Tadlock a unified sentence of five years with one year determinate.

CONCLUSION
Any error by the district court in failing to instruct the jury as to the common law necessity defense was harmless in light of the jury verdict finding Tadlock guilty of possession with the intent to deliver. The district court did not violate Tadlock's constitutional right of free speech when it considered at sentencing Tadlock's expressions of belief that marijuana use should be legal. Finally, we conclude that the district court acted within its discretion when it sentenced Tadlock to a unified term of five years' imprisonment with one year determinate. The judgment of conviction and sentence are therefore affirmed.
Chief Judge SCHWARTZMAN and Judge PERRY concur.
