Swept up by a wave of patriotism after the U.S. invasion of Iraq, Chris Magaoay joined the Marine Corps in November 2004.

The newly married Magaoay thought a military career would allow him to continue his college education, help his country and set his life on the right path.

Less than two years later, Magaoay became one of thousands of military deserters who have chosen a lifetime of exile or possible court-martial rather than fight in Iraq or Afghanistan.

“It wasn’t something I did on the spur of the moment,” said Magaoay, a native of Maui, Hawaii. “It took me a long time to realize what was going on. The war is illegal.”

Magaoay said his disillusionment with the military began in boot camp in Twentynine Palms, Calif., where a superior officer joked about killing and mistreating Iraqis. When his unit was deployed to Iraq in March, Magaoay and his wife drove to Canada, joining a small group of deserters who are trying to win permission from the Canadian government to stay.

“We’re like a tight-knit family,” Magaoay said.

The Pentagon says deserters like Magaoay represent a tiny fraction of the nation’s fighting forces.

“The vast majority of soldiers who desert do so for personal, family or financial problems, not for political or conscientious objector purposes,” said Lt. Col. Bryan Hilferty, a spokesman for the Army.

Since 2000, about 40,000 troops from all branches of the military have deserted, the Pentagon says. More than half served in the Army. But the Army says numbers have decreased each year since the United States began its war on terror in Afghanistan.

Those who help war resisters say desertion is more prevalent than the military has admitted.

“They lied in Vietnam with the amount of opposition to the war and they’re lying now,” said Eric Seitz, an attorney who represents Army Lt. Ehren Watada, the first commissioned officer to refuse deployment to the war in Iraq.

Watada is under military custody in Fort Lewis, Wash., because he refused to join his Stryker brigade when it was sent to Iraq last month.

Watada said he doesn’t object to war but considers the conflict in Iraq illegal. The Army has turned down his request to resign and plans to file charges against him.

Critics of the Iraq war have demonstrated on the lieutenant’s behalf. Conservative bloggers call him a traitor and opportunist.

Joe Davis, spokesman for the Veterans of Foreign Wars, said deserters aren’t traitors because they’ve done nothing to help America’s enemies. But he rejects arguments that deserters have a moral right to refuse to fight wars they consider unjust.

“None of us can choose our wars. They’re always a political decision,” Davis said. “They’re letting their buddies down and hurting morale - and morale is everything on the battlefront.”

Because today’s military is an all-volunteer force, troops seeking objector status must convince superior officers they’ve had an honest change of heart about the morality of war.

The last time the U.S. military executed a deserter was World War II. But hundreds face court-martials and imprisonment every year.

Members of the armed forces are considered absent without leave when they are unaccounted for. They become deserters after they’ve been AWOL for 30 days.

A 2002 Army report says desertion is fairly constant but tends to worsen during wartime, when there’s an increased need for troops and enlistment standards are more lax. They also say deserters tend to be less educated and more likely to have engaged in delinquent behavior than other troops.

Army spokesman Hilferty said the Army doesn’t try to find deserters. Instead, their names are given to civilian law enforcement officers who often nab them during routine traffic stops and turn them over to the military.

Commanders then decide whether to rehabilitate or court-martial the alleged deserter. There’s an incentive to rehabilitate because it costs the military an average of $38,000 to recruit and train a replacement.

Jeffry House, an attorney in Toronto who represents Magaoay and other deserters, said there are about 200 deserters living in Canada. They have decided not to seek refugee status but instead are leading clandestine lives, he said.

Like many of the people helping today’s war resisters, House fled to Canada to avoid the Vietnam War. About 50,000 Americans sought legal residency in Canada during the Vietnam era.

“You would apply at the border and if you didn’t have a criminal record, you were in,” House said.

He said changes in Canadian law make it harder for resisters to flee north. Now, potential immigrants must apply for Canadian residency in their home countries. Resisters say that exposes them to U.S. prosecution.