In military terminology, desertion is the abandonment of a "duty" or post without permission from one's Government or superior. Ultimate "duty" or "responsibility," however, under International Law, is not necessarily always to a "Government" nor to a "superior," as we see in the fourth of the Nuremberg Principles, which states:
"The fact that a person acted pursuant to order of his Government or of a superior does not relieve him from responsibility under international law, provided a moral choice was in fact possible to him."This Nuremberg Principle of "moral choice," "morality," or "conscience" being the higher authority was subsequently formulated into International Law by the United Nations as we see in this quote:![]()
"Under UN General Assembly Resolution 177 (II), paragraph (a), the International Law Commission was directed to "formulate the principles of international law recognized in the Charter of the Nuremberg Tribunal and in the judgment of the Tribunal.""In 1998, the United Nations Office of the High Commissioner for Human Rights document called “Conscientious objection to military service, United Nations Commission on Human Rights resolution 1998/77” recognized that “persons [already] performing military service may develop conscientious objections” while performing military service.![]()
People who are away for more than 30 days but return voluntarily or indicate a credible intent to return may still be considered AWOL, while those who are away for fewer than 30 days but can credibly be shown to have no intent to return (as by joining the armed forces of another country) may nevertheless be tried for desertion or in some rare occasions treason if enough evidence is found.
In the United States, before the Civil War, deserters from the Army were flogged, while after 1861 tattoos or branding were also adopted. The maximum U.S. penalty for desertion in wartime remains death, although this punishment was last applied to Eddie Slovik in 1945. No US servicemember has received more than 18 months imprisonment for desertion or missing movement during the Iraq war. 
AWOL/UA may be punished with nonjudicial punishment (NJP; called "office hours" in the Marines). It is usually punished by Court Martial for repeat or more severe offenses.
Also, "Missing Movement" is another term which is used to describe when a particular servicemember fails to arrive at the appointed time to deploy (or "move out") with their assigned unit, ship, or aircraft; in the United States military, it is a violation of the 87th article of the Uniform Code of Military Justice. The offense is similar to AWOL, but considered more severe.
Less severe is "Failure to Repair," consisting of missing a formation, or failing to appear at an assigned place and time when so ordered.
The desertion rate in the U.S. army was 8.3% (9,200 out of 111,000), compared to 12.7% during the War of 1812 and usual peacetime rates of about 14.8% per year. Many men deserted in order to join another U.S. unit and get a second enlistment bonus. Others deserted because of the miserable conditions in camp, or were using the army to get free transportation to California, where they deserted to join the gold rush.
Several hundred deserters went over the to Mexican side; nearly all were recent immigrants from Europe with weak ties to the U.S. The most famous group was the Saint Patrick's Battalion, about half of whom were Catholics from Ireland. The Mexicans issued broadsides and leafiets enticing U.S. soldiers with promises of money, land bounties, and officers' commissions. Mexican guerrillas shadowed the U.S. Army, and captured men who took unauthorized leave or fell out of the ranks. The guerrillas coerced these men to join the Mexican ranks—threatening to kill them if they failed to comply. The generous promises proved illusory for most deserters, who risked getting shot if captured by U.S. forces. About fifty of the San Patricios were tried and hung following their capture at Churubusco in August 1847.
One example of desertion in the Civil War was Confederate soldier Arthur Muntz, who was killed by his fellow soldiers after deserting at The First Battle of Bull Run. In many cases, in the early years of the war, the Confederate Home Guard dealt with deserters. For a time, the Confederate government offered a bounty to be paid for the capture and return of deserters. However as the war progressively got worse for the south, often Home Guard units would deal with desertion as they saw fit, whether that be by execution or imprisonment.
In Arkansas, many units deserted completely when rumors spread that local Indians had raided towns and scalped citizens, with the soldiers feeling their place was at home rather than fighting in the war. There were also instances across the southern states where whole units deserted together, banding together and living in the mountains, at times fighting against Union Army regulars if forced to do so, but also raiding civilian farms to obtain food or supplies.
The fictional story of a wounded Confederate deserter is told in the novel Cold Mountain, who at the end of the Civil War walks for months to return home to the love of his life after receiving her letters pleading him to come home. Many Confederate units had signed on, initially, for a one year service, and felt completely justified in walking away when they'd reached their breaking point. By the war's end, it was estimated that the Confederacy had lost 103,400 soldiers to desertion. 
The Union Army also faced large scale desertions. Despite the south fighting what was considered by 1863 to be a lost cause, it is estimated that Confederate forces lost fewer to desertion than did the northern forces. This has been partly attributed to the southern soldiers fighting a defensive war, on their own ground, rather then an offensive war of invasion, which gave the southern soldiers a sense that they were defending their homeland. New York alone suffered 44,913 desertions by the war's end, with Pennsylvania having 24,050 and Ohio having 18,354, not to mention the desertions faced by the other northern states.
The 'Lost Division' was a term given to the estimated 19,000 U.S. Army soldiers absent without leave in France at the close of World War II.
Of the Germans who deserted the Wehrmacht, 15,000 men were executed. In June 1988 the Initiative for the Creation of a Memorial to Deserters came to life in Ulm (birthplace of Albert Einstein). A central idea was, "Desertion is not reprehensible, war is".
The number had reached about 8,000 by the first quarter of 2006.
Another report stated that since 2000, about 40,000 troops from all branches of the military have deserted, also according to the Pentagon. More than half of these served in the US Army
Almost all of these soldiers deserted within the USA. There has only been one reported case of a desertion in Iraq. The Army, Navy and Air Force reported 7,978 desertions in 2001, compared with 3,456 in 2005. The Marine Corps showed 1,603 Marines in desertion status in 2001. That had declined by 148 in 2005.
A ruling from the Canadian Federal Court in September 2008, clearly recognizes that in the US while most deserters are not punished, the ones who are punished, with sentences of up to 18 months, are the ones who speak out publicly in objection to the War in Iraq or to the actions of the US Military in that war.