Mauricio Funes, who currently lives in Nicaragua, denies the charges and says 2012 truce was brokered by the church.
The sentence on Monday follows a trial that began in April with Funes living in neighbouring Nicaragua. El Salvador changed its laws last year to allow trials in absentia.
Prosecutors had accused Funes, who served as president from 2009 to 2014, of illicit association and failure to perform his duties for a gang truce negotiated in 2012.
Funes had denied negotiating with the gangs or giving their leaders any privileges, stressing that the truce was brokered by the Catholic Church, not the government.
Funes’s former security minister, General David Munguia Payes, was sentenced to 18 years in prison for his involvement in the negotiations.
“We were able to verify that these two former officials, who had the obligation to protect Salvadorans, negotiated their lives in exchange for electoral favours, acting as gang members,” Attorney General Rodolfo Delgado said on Twitter.
Funes’s 14-year sentence was the sum of eight years for illicit association and six years for failure to perform duties.
Prosecutors say the gang negotiations were aimed at getting the country’s powerful street gangs to lower the homicide rate in exchange for benefits to their imprisoned leaders.
El Salvador has pursued Funes, 64, for other alleged crimes in at least a half dozen cases.
In 2015, El Salvador’s Supreme Court ruled that the gangs are “terrorist” organisations.
The two main criminal groups in El Salvador, Mara Salvatrucha – more commonly referred to as MS-13 – and Barrio 18, have an estimated 70,000 members between them.
Over the past year, several thousand suspected gang members have been rounded up as part of current President Nayib Bukele’s push to crack down on the groups.
Before Bukele imposed his contentious “state of exception”, however, the right-wing leader was accused of engaging in negotiations with the gangs.
In December 2021, the United States Treasury said that Bukele’s government secretly negotiated a truce with gang leaders.
Imprisoned leaders were allegedly given privileges in exchange for slowing down killings and for giving political support to Bukele’s party. Local news outlet El Faro had previously reported on the negotiations.
Former Attorney General Raul Melara had said he would investigate the allegations, but after Bukele’s party dominated midterm elections in 2021 and took control of Congress, lawmakers ousted Melara.
Rights groups have criticised El Salvador’s heavy-handed crackdown on suspected gang members, with Amnesty International accusing Bukele’s government of widespread violations.
“The systematic violation of human rights and the dismantling of the rule of law are not the answer to the problems facing the country,” Amnesty said in a report last month.