Life of Joseph Smith from 1838 to 1839

The life of Joseph Smith from 1838 to 1839, when he was 33–34 years old, covers a period beginning when Smith left Ohio in January 1838 until he left Missouri and moved to Nauvoo, Illinois in 1839.
Life in Missouri.
Smith's early revelations identified western Missouri as Zion, the place for Mormons to gather in preparation for the second coming of Jesus Christ. Independence, Missouri, was identified as "the center place" and the spot for building a temple. Smith first visited Independence in the summer of 1831, and a site was dedicated for the construction of the temple. Soon afterward, Mormon converts—most of them from the New England area—began immigrating in large numbers to Independence and the surrounding area.
The Latter Day Saints had been migrating to Missouri ever since Smith had claimed the area to be Zion. They simultaneously occupied the Kirtland area, as well as the Independence area for around seven years. Following the failure of the Kirtland Safety Society, Smith fled for Missouri in January 1838, and the rest of the remaining Latter Day Saints followed.
Violence escalated and was often not handled by the legal authorities: 
Within four months of that ruling, 800 followers of Joseph Smith were forcibly dispossessed of their homes and businesses. A long trail of appeals went as far as Washington D.C. with Joseph receiving a personal audience with President Martin Van Buren, who said he could not help. Congress sent the matter back to the state of Missouri.
Local leaders saw their Latter Day Saints as a religious and political threat, alleging that Smith and his followers would vote in blocs. Additionally, Mormons purchased vast amounts of land in which to establish settlements, and held abolitionist viewpoints, including Smith himself. Thus they clashed with the pro-slavery persuasions of the majority of Missourians. Tensions were fueled by the announcement by Smith that Jackson County, Missouri would be the New Jerusalem and that the surrounding lands were promised to the Church by God and that the Saints would inhabit that area.
Mob violence.
In response to the consistent persecution, a small group of Latter Day Saints organized themselves into a vigilante group called the Danites, led by Dr. Sampson Avard. Smith's exact role in the Danite society is unknown; some suggest that he held a leading or even founding position, while others believe he had no knowledge of the Danites before their existence was publicly recognized. Later, Smith stated that he disapproved of the group and Avard was excommunicated for his activities.
Soon the "old Missourians" and the LDS settlers were engaged in a conflict sometimes referred to as the 1838 Mormon War. One key skirmish was the Battle of Crooked River, which involved Missouri state troops and a group of Saints. There is some debate as to whether the Mormons knew their opponents were government officials, but the battle's aftermath was pivotal in Church history.
This battle led to reports of a "Mormon insurrection" and the death of apostle David W. Patten. In consequence of the reports of the battle, the burning out of ex-Mormon 'apostates' by the Danites, the attack on non-Mormons in Caldwell County, the sacking of Gallatin by the Mormons and their reported plans to burn Richmond and Liberty, Missouri Governor Lilburn Boggs issued Missouri Executive Order 44, also known as the "Extermination Order" on October 27, 1838. The order stated that the Mormon community was in "open and avowed defiance of the laws, and of having made war upon the people of this State ... the Mormons must be treated as enemies, and must be exterminated or driven from the State if necessary for the public peace—their outrages are beyond all description." The Extermination Order was not officially rescinded until 1976 by Governor Christopher S. Bond.
Soon after the "Extermination Order" was issued, vigilantes attacked an outlying Mormon settlement and killed seventeen people. This event is identified as the Haun's Mill Massacre. Soon afterward, the 2,500 troops from the state militia converged on the Mormon headquarters at Far West. Smith and several other Church leaders surrendered to state authorities on charges of treason. Although they were civilians, the militia leader threatened to try Smith and others in a military tribunal and have them immediately executed. Were it not for the actions of General Alexander William Doniphan in defense of due process, the plans of the militia leaders likely would have been carried out.
The legality of Boggs' "Extermination Order" was debated in the legislature, but its objectives were achieved. Most of the Mormon community in Missouri had either left or been forced out by the spring of 1839.
Imprisonment and escape from Liberty Jail.
After losing the Mormon War (1838), Smith and other church leaders were then transferred to the jail at Liberty, Missouri, the Clay County seat, to await trial. Although he frequently called down imprecatory judgments on his enemies and perceived enemies, as Fawn Brodie has written, Smith bore his harsh imprisonment "stoically, almost cheerfully, for there was a serenity in his nature that enabled him to accept trouble along with glory." Smith wrote to his followers "with skill and tact" attempting to dispel the now current notion that he was a fallen prophet. Brigham Young later claimed that even Smith's brother William said he hoped that Joseph would never get out of the hands of his enemies alive. Smith and his companions also made two unsuccessful attempts to escape from jail before, on April 6, they were started under guard to stand trial in Daviess County.
Once the Latter Day Saints no longer posed a political threat, Missouri leaders realized that Mormon behavior could hardly be classified as treason whereas, as Fawn Brodie has written, the governor's "exterminating order stank to heaven." On the way to trial, the sheriff and guards agreed to get drunk on whiskey purchased by Joseph's brother Hyrum and looked the other way while their prisoners escaped.