Answer by taking a quote from the following article:

Andrew Jackson (March 15, 1767 - June 8, 1845) was an American soldier and statesman who served as the seventh president of the United States from 1829 to 1837. Before being elected to the presidency, Jackson gained fame as a general in the United States Army and served in both houses of Congress. As president, Jackson sought to advance the rights of the "common man" against a "corrupt aristocracy" and to preserve the Union. Born in the colonial Carolinas to a Scotch-Irish family in the decade before the American Revolutionary War, Jackson became a frontier lawyer and married Rachel Donelson Robards.

Andrew Jackson was born on March 15, 1767, in the Waxhaws region of the Carolinas. His parents were Scots-Irish colonists Andrew and Elizabeth Hutchinson Jackson, Presbyterians who had emigrated from present day Northern Ireland two years earlier. Jackson's father was born in Carrickfergus, County Antrim, in current-day Northern Ireland, around 1738. Jackson's parents lived in the village of Boneybefore, also in County Antrim. His paternal family line originated in Killingswold Grove, Yorkshire, England.  When they immigrated to North America in 1765, Jackson's parents probably landed in Philadelphia. Most likely they traveled overland through the Appalachian Mountains to the Scots-Irish community in the Waxhaws, straddling the border between North and South Carolina. They brought two children from Ireland, Hugh (born 1763) and Robert (born 1764). Jackson's father died in a logging accident while clearing land in February 1767 at the age of 29, three weeks before his son Andrew was born. Jackson, his mother, and his brothers lived with Jackson's aunt and uncle in the Waxhaws region, and Jackson received schooling from two nearby priests.  Jackson's exact birthplace is unclear because of a lack of knowledge of his mother's actions immediately following her husband's funeral. The area was so remote that the border between North and South Carolina had not been officially surveyed. In 1824 Jackson wrote a letter saying that he was born on the plantation of his uncle James Crawford in Lancaster County, South Carolina. Jackson may have claimed to be a South Carolinian because the state was considering nullification of the Tariff of 1824, which he opposed. In the mid-1850s, second-hand evidence indicated that he might have been born at a different uncle's home in North Carolina.  In 1794, Jackson formed a partnership with fellow lawyer John Overton, dealing in claims for land reserved by treaty for the Cherokee and Chickasaw. Like many of their contemporaries, they dealt in such claims although the land was in Indian country. Most of the transactions involved grants made under the 'land grab' act of 1783 that briefly opened Indian lands west of the Appalachians within North Carolina to claim by that state's residents. He was one of the three original investors who founded Memphis, Tennessee, in 1819.  After moving to Nashville, Jackson became a protege of William Blount, a friend of the Donelsons and one of the most powerful men in the territory. Jackson became attorney general in 1791, and he won election as a delegate to the Tennessee constitutional convention in 1796. When Tennessee achieved statehood that year, he was elected its only U.S. Representative. He was a member of the Democratic-Republican Party, the dominant party in Tennessee. Jackson soon became associated with the more radical, pro-French and anti-British wing. He strongly opposed the Jay Treaty and criticized George Washington for allegedly removing Republicans from public office. Jackson joined several other Republican congressmen in voting against a resolution of thanks for Washington, a vote that would later haunt him when he sought the presidency. In 1797, the state legislature elected him as U.S. Senator. Jackson seldom participated in debate and found the job dissatisfying. He pronounced himself "disgusted with the administration" of President John Adams and resigned the following year without explanation. Upon returning home, with strong support from western Tennessee, he was elected to serve as a judge of the Tennessee Supreme Court at an annual salary of $600. Jackson's service as a judge is generally viewed as a success and earned him a reputation for honesty and good decision making. Jackson resigned the judgeship in 1804. His official reason for resigning was ill health. He had been suffering financially from poor land ventures, and so it is also possible that he wanted to return full-time to his business interests.  After arriving in Tennessee, Jackson won the appointment of judge advocate of the Tennessee militia. In 1802, while serving on the Tennessee Supreme Court, he declared his candidacy for major general, or commander, of the Tennessee militia, a position voted on by the officers. At that time, most free men were members of the militia. The organizations, intended to be called up in case of conflict with Europeans or Indians, resembled large social clubs. Jackson saw it as a way to advance his stature. With strong support from western Tennessee, he tied with John Sevier with seventeen votes. Sevier was a popular Revolutionary War veteran and former governor, the recognized leader of politics in eastern Tennessee. On February 5, Governor Archibald Roane broke the tie in Jackson's favor. Jackson had also presented Roane with evidence of land fraud against Sevier. Subsequently, in 1803, when Sevier announced his intention to regain the governorship, Roane released the evidence. Sevier insulted Jackson in public, and the two nearly fought a duel over the matter. Despite the charges leveled against Sevier, he defeated Roane, and continued to serve as governor until 1809.  After arriving in New Orleans on December 1, 1814, Jackson instituted martial law in the city, as he worried about the loyalty of the city's Creole and Spanish inhabitants. At the same time, he formed an alliance with Jean Lafitte's smugglers, and formed military units consisting of African-Americans and Muscogees, in addition to recruiting volunteers in the city. Jackson received some criticism for paying white and non-white volunteers the same salary. These forces, along with U.S. Army regulars and volunteers from surrounding states, joined with Jackson's force in defending New Orleans. The approaching British force, led by Admiral Alexander Cochrane and later General Edward Pakenham, consisted of over 10,000 soldiers, many of whom had served in the Napoleonic Wars. Jackson only had about 5,000 men, most of whom were inexperienced and poorly trained.  The British arrived on the east bank of the Mississippi River on the morning of December 23. That evening, Jackson attacked the British and temporarily drove them back. On January 8, 1815, the British launched a major frontal assault against Jackson's defenses. An initial artillery barrage by the British did little damage to the well-constructed American defenses. Once the morning fog had cleared, the British launched a frontal assault, and their troops made easy targets for the Americans protected by their parapets. Despite managing to temporarily drive back the American right flank, the overall attack ended in disaster. For the battle on January 8, Jackson admitted to only 71 total casualties. Of these, 13 men were killed, 39 wounded, and 19 missing or captured. The British admitted 2,037 casualties. Of these, 291 men were killed (including Pakenham), 1,262 wounded, and 484 missing or captured. After the battle, the British retreated from the area, and open hostilities ended shortly thereafter when word spread that the Treaty of Ghent had been signed in Europe that December. Coming in the waning days of the war, Jackson's victory made him a national hero, as the country celebrated the end of what many called the "Second American Revolution" against the British. By a Congressional resolution on February 27, 1815, Jackson was given the Thanks of Congress and awarded a Congressional Gold Medal.  Alexis de Tocqueville ("underwhelmed" by Jackson according to a 2001 commentator) later wrote in Democracy in America that Jackson "was raised to the Presidency, and has been maintained there, solely by the recollection of a victory which he gained, twenty years ago, under the walls of New Orleans."

What was his role in the war?
After arriving in New Orleans on December 1, 1814, Jackson instituted martial law in the city,