An Israeli soldier who was jailed earlier this week for eating a non-kosher sandwich has been freed after the army agreed to release him following a wave of public pressure.

The soldier, who recently immigrated to Israel from America, was initially jailed for 11 days after eating a sandwich containing pork, which is forbidden by Jewish dietary law, public radio reported.

News of his punishment spread quickly on social media, sparking a public outcry which prompted the army to revoke the punishment, admitting it had made a mistake.

"The bottom line is that we were wrong," army spokesman Brigadier General Moti Almoz said on his official Facebook page.

"The punishment, which was given to the soldier, was cancelled and he will be released home.

"On the one hand, the IDF [Israeli Defence Force] will continue to keep kosher, but we not poke our noses into soldiers' sandwiches."

Brigadier General Almoz said there were tensions within Israeli society but that the army had a "place for everyone".

Public radio said the offending sandwich was given to the soldier by his grandmother who lives on a kibbutz and who had offered to take his place in jail.

Army radio quoted one of his uncles as saying he was "stunned" by the decision to jail his nephew over the contents of his lunchbox.

Known as "kashrut", Jewish dietary law bars consumption of certain foods such as pork and shellfish and prohibits the mixing of meat and dairy products.

Animals must be slaughtered ritually under the supervision of a rabbi.

As an official Israeli institution, the army is bound to respect such dietary rules in its mess halls.

AFP