A British teacher jailed after she allowed her students to name a teddy bear Muhammad was released Monday hours after Sudan's president pardoned her, a British embassy spokesman said.

Gillian Gibbons' conviction under Sudan's Islamic Sharia law shocked Britons and many Muslims worldwide. Hard-line Muslim clerics in Sudan accused her of intentionally seeking to insult Islam's Prophet Muhammad, and the case angered some Sudanese, sparking a protest where demonstrators called for her execution.

Gibbons said in a written statement delivered to Sudan's President Omar al-Bashir that she did not intend to offend anyone and had great respect for Islam. Her release came after two British Muslim politicians from the House of Lords met with al-Bashir to plead for her release.

"She is in British Embassy custody and is with the deputy British ambassador," embassy spokesman Omar Daair said. He would not give her exact location or say when she would leave Sudan.

Gibbons, 54, was sentenced Thursday to 15 days in prison and deportation for insulting Islam because she allowed her students to name a teddy bear Muhammad — a common name among Muslim men — in a class project on animals. The trial was sparked when a school secretary complained to the Education Ministry that Gibbons aimed to insult the Prophet Muhammad. Her time in jail since her arrest Nov. 25 counted toward the sentence.

Embassy spokesman Omar Daair said the Gibbons was in "British embassy custody," but he would not give her exact location or say when she would leave Sudan, citing security reasons.

Lord Nazir Ahmed, who met with al-Bashir earlier Monday along with Baroness Sayeeda Warsi, said the case was an "unfortunate misunderstanding" and stressed that Britain respected Islam.

He hoped "the relations between our two countries will not be damaged by this incident," Ahmed told reporters at the presidential palace after Monday's meeting.

Ghazi Saladdin, a senior presidential adviser, said al-Bashir insisted that Gibbons had a "fair trial," but he agreed to pardon her because of the efforts by the British Muslim delegation.

It was unclear when Gibbons would leave Sudan. Earlier Monday, Sudanese presidential spokesman Mahzoub Faidul told The Associated Press that Gibbons would "fly back to England today." However, travel agents in Sudan said the earliest European-bound flights would not leave Khartoum until the early hours on Tuesday.

The director of Khartoum's Unity High School, where Gibbons worked, said the embassy told him Monday that she would be "coming over shortly" to the school to pick up her gear before leaving the country.

"We are very relieved and happy that she has been pardoned," said director Robert Boulos.

In the written statement released by Sudanese presidential palace and read by Warsi to reporters, 54-year-old Gibbons said she was sorry if she caused any "distress."

"I have a great respect for the Islamic religion and would not knowingly offend anyone," Gibbons, who was sentenced Thursday, said in the statement.

"I am looking forward to seeing my family and friends, but I am very sorry that I will be unable to return to Sudan," the statement read.

The teacher escaped harsher punishment that could have included up to 40 lashes, six months in prison and a fine. Her time in jail since her arrest last Sunday counted toward the sentence.

During her trial, the weeping teacher said she had intended no harm. Her students, overwhelmingly Muslim, chose the name for the bear. Muslim scholars generally agree that intent is a key factor in determining if someone has violated Islamic rules against insulting the prophet.

The conviction shocked many Britons, but the case was caught up in the ideology that al-Bashir's Islamic regime has long instilled in Sudan, a mix of anti-colonialism, religious fundamentalism and a sense that the West is besieging Islam.

In Britain, Prime Minister Gordon Brown said he was delighted by news.

"Common sense has prevailed," Brown said in a statement released by his office.

The case also sparked criticism from many Muslims in the West who said she should have never been arrested. On Monday, Inayat Bunglawala, a spokesman for the Muslim Council of Britain, welcomed the pardon.

"It will be wonderful to see her back in the U.K. I am sure she will be welcomed by both Muslims and non-Muslims after her quite terrible ordeal at the hands of the Sudanese authorities," Bunglawala said.

A small group of about 40 protesters gathered briefly Monday in front of the British embassy in Khartoum and handed over a petition, spokesman Daair said, without describing the petition. But several cars of riot police arrived and dispersed the crowd.

On Friday during a rally in Khartoum, thousands of protesters, many armed with clubs and swords and beating drums, burned pictures of her and demanded her execution.

After the rally, there were fears for Gibbons' safety and she was moved from the Omdurman women's prison to a secret location, her lawyer has said.

There was no overt sign that the government organized the protest, but such a rally could not have taken place without at least official assent.

Sudan's ambassador in London, Khalid al-Mubarak, insisted Monday that the demonstrations "were an argument from the fringe."