The plea deal ensures Staff Sgt. Robert Bales will not receive the death penalty for the shootings, which took place during his most recent deployment to Afghanistan.
A jury will decide in August whether Bales will spend the rest of his life at the U.S. military prison at Ft. Leavenworth, Kan.
At the time of the shootings, the 39-year old Iraqi war veteran had been in Afghanistan since December on his fourth combat tour in 10 years.
During the court martial, military investigators provided physical evidence, including blood samples, tying Bales to the shootings in both villages.
Other Afghan eyewitnesses, testifying via satellite from the U.S. air base in Kandahar, identified Bales as the shooter.
During his court martial at Joint Base Lewis-McChord in Washington, Bales told the court there was "no good reason in the world" for the shooting rampage, according to CBS News.
"I've asked that question a million times since then," Bales told Army judge Col. Jeffery Nance on Thursday.
"There's not a good reason in this world for why I did the horrible things I did," Bales added.
Bales’s attorney, John Henry Browne, told reporters Bales suffers from post-traumatic stress disorder (PTSD), which may have triggered the massacre.
"He is broken, he was broken, and we broke him," Browne said.
The incident prompted those inside the Pentagon and on Capitol Hill to revisit the issue of PTSD and the overall state of the U.S. military, as the Pentagon prepares to end over a decade of war in Afghanistan next year.
As a result, Army leaders are beginning to attach "embedded behavioral health" teams alongside Army brigade combat teams when they deploy. The healthcare teams are on the front lines with U.S. soldiers and maintain close ties to the ground commanders.
In addition, soldiers are screened for possible cases of PTSD five times during any given combat rotation.
Soldiers get three screenings before, during and after a deployment. They are screened again between 90 to 100 days after they return home. A final screening is conducted a year after a soldier’s combat rotation.