FORT CARSON, Colo.—A female soldier in the U.S. Army pleaded guilty Monday to two counts of desertion after fleeing to Canada to avoid a second tour of duty in the Iraq war.

Pfc. Kimberly Rivera was sentenced to 10 months in prison and a bad-conduct discharge after entering her plea at a court-martial.

Rivera, 30, was a wheeled-vehicle driver in Fort Carson’s 4th Infantry Brigade Combat Team and served in Iraq in 2006. She has said that, while there, she became disillusioned with the U.S. mission in Iraq.

During a two-week leave in the U.S. in 2007, Rivera crossed the Canadian border after she was ordered to serve another tour in Iraq.

The Colorado Springs Gazette reported that when judge Col. Timothy Grammel asked Rivera on Monday how long she remained absent, Rivera replied: “As long as I possibly could, sir. … I intended to quit my job permanently.”

After fleeing to Canada, Rivera applied for refugee status but was denied.

Rivera then applied for permanent residency, but Canadian immigration officials rejected that application, too. Authorities also rejected her requests to stay on humanitarian and compassionate grounds.

Rivera was first ordered to leave Canada or face deportation in 2009, but she appealed that decision. The mother of four faced another deportation order issued in 2012.

She was arrested at the U.S. border and taken into military custody.

Roughly 19,000 people signed an online petition in Canada protesting Rivera’s deportation order, and rallies were held in a number of Canadian cities calling on the government to let her stay in the country.

Nobel Peace Prize winner Archbishop Desmond Tutu and the U.S. veterans organization Veterans for Peace also protested the deportation order.

During her sentencing hearing, government lawyers argued that Rivera, who was granted leave shortly into her tour to work out marital issues, failed to return because her husband threatened to leave her and take their children, The Gazette reported.

Rivera’s civilian defense attorney, James Matthew Branum, argued that Rivera never filed for status as a conscientious objector because she didn’t know the option was available to her. He said Rivera should have been informed about it when she met with a chaplain in Iraq over concerns that she couldn’t take a life, The Gazette reported.

In 2012, the War Resisters Support Campaign, a Canadian activist group, estimated that there were about 200 Iraq war resisters in Canada. It said two other Iraq war resisters who were deported, Robin Long and Clifford Cornell, faced lengthy jail sentences upon their return.

Long was given a dishonorable discharge in 2008 and sentenced to 15 months in a military prison after pleading guilty to charges of desertion.

The lower house of Canada’s Parliament most recently passed a motion in 2009 in favor of allowing U.S. military deserters to stay, but the Conservative Party government was not persuaded.

During the Vietnam War, as many as 90,000 Americans won refuge in Canada, most of them to avoid the military draft. Many were given permanent residence status that led to Canadian citizenship, but the majority went home after President Jimmy Carter granted amnesty in the late 1970s.

Some Canadian politicians say the situation is different now because Iraq war deserters like Rivera enlisted in the U.S. military voluntarily.