AMMAN (Reuters) - A Jordanian military court sentenced a soldier to life imprisonment with hard labor on Monday for killing three U.S. military trainers last year, a judicial source said on Monday.

The killing in November at the Jafr airbase in the south of the country caused tensions between the United States and Jordan, who are long-standing allies.

Jordanian authorities at first said the U.S. trainers were shot because they failed to stop their car as they drove up to the gate of a large air base.

Washington rejected that account and said it could not rule out a political motive for the killings, which occurred in November.

Jordan then changed its position and charged the soldier, Sergeant Marek Sami Salem, with premeditated murder. He had pleaded not guilty, the source said.

After the head of the military court read the verdict the soldier shouted: “I only did my duty!”

Jordan hosts several hundred U.S. contractors in a military cooperation program which includes the stationing of U.S. F-16 fighter jets. They use Jordanian airfields to hit Islamic State positions in neighboring Syria and help protect its borders.

The base is located in a conservative Bedouin region of Jordan where radical Sunni Muslim influence has grown over the last decade.

Several Islamist militant attacks in the past year have jolted the Arab kingdom, which largely escaped the violence that has swept parts of the Middle East since 2011.

Members of the families of the dead were present at the court but did not speak to the press.

“We are reassured to see the perpetrator brought to justice,” Eric Barbee, the spokesman of the U.S. embassy in Amman said in a statement sent to Reuters.

“Despite this tragedy, Jordan remains a strategic partner,” Barbee added.

Barbee said embassy representatives who attended the trial had praised what they described as the “expedience and seriousness of the court proceedings”.