KHARTOUM, Sudan — A British teacher went on trial Thursday on charges of inciting religious hatred by letting her students name a teddy bear Muhammad, a crime punishable by up to 40 lashes and six months in jail.

Gillian Gibbons walked in without handcuffs, wearing a dark jacket and blue skirt, according to reporters in the courtroom before media were ordered out of the chamber. Riot police surrounded the courthouse.

Muhammad is a common name among Muslim men, but giving the name of Islam's founder to an animal would be seen as insulting by many Muslims.

In a statement read to the court, Gibbons explained the incident and emphasized that her 7-year-old students picked the teddy bear's name, British Embassy spokesman Omar Daair told The Associated Press. Gibbons' lawyer said she would likely take the stand later.

The case set up an escalating diplomatic dispute with Britain, Sudan's former colonial ruler.

Prosecutor-General Salah Eddin Abu Zaid told the AP the British teacher could expect a "swift and fair trial." If convicted, she faces up to 40 lashes, six months in jail and a fine, with the verdict and any sentence up to the judge's discretion, official have said.

The judge ordered the prosecution to bring forward the person who originally raised the complaint against Gibbons — an office assistant at the Unity High School, said Isam Abu Hasabu, the head of the school's parent-teacher association, who was in the courtroom.

Gibbons' chief lawyer, Kamal Djizouri, scuffled with a tight police cordon before he was allowed in. British diplomats who were initially barred were also eventually allowed to enter.

Djizouri said he would argue her case based on Islamic Sharia law and show there was "absolutely no intention to insult religion, and for blasphemy to take place there must be an insult."

Gibbons was teaching her pupils, who are around age 7, about animals, and asked one of them to bring in her teddy bear, according to Robert Boulos, the director for Unity High School.

Gibbons asked the students to pick names for it and they proposed Abdullah, Hassan and Muhammad, and in September, the pupils voted to name it Muhammad, he said.

Each child was allowed to take the bear home on weekends and write a diary about what they did with it. The diary entries were collected in a book with the bear's picture on the cover, labeled, "My Name is Muhammad," he said. The bear itself was never labeled with the name, he added.

Initial reports said a parent had complained about Gibbons, but Boulos said he was later told it was a staffer. He said parents of the students supported Gibbons.

"We hope the case will be dismissed," said Boulos, adding the school could hire private guards to protect Gibbons' when she returned. "She is a marvelous teacher, she was even training our other primary teachers."

Episcopalian Bishop Ezekiel Kondo, Gibbons' employer, was expected to testify for the defense.

The charges against Gibbons, who was arrested in her home in Khartoum on Sunday, have angered the British government. British and American Muslim groups also criticized the decision.

In London, Foreign Secretary David Miliband said British diplomats "will do everything to avoid" any of the possible sentences that could be imposed on the teacher.

"There is an innocent misunderstanding at the heart of this, not a criminal offense," Miliband said.

He met later with Sudan's ambassador and said the envoy promised to relay the British government's concerns over the case and Britain's respect for Islam.

A spokesman at the Sudanese Embassy in London said he did not think Gibbons would be convicted.

"Mrs. Gibbons has consular support, the British Embassy has one of the best solicitors in the country, whom I know personally," said Khalid al Mubarak.

Officials in Sudan's Foreign Ministry have tried to play down the case, calling it an isolated incident and initially predicting Gibbons could be released without charge.

But hard-liners have considerable weight in the government of President Omar al-Bashir, which came to power in a 1989 military coup saying it wanted to create an Islamic state.

The country's top Muslim clerics have pressed the government to ensure Gibbons is punished, comparing her action to author Salman Rushdie's "blasphemies" against the Prophet Muhammad.

The British novelist was accused of blasphemy by many Muslims for his 1988 novel "The Satanic Verses," which had a character seen as a reference to the prophet. Iran's Ayatollah Ruhollah Khomeini issued a religious edict calling for Rushdie's death.

The north of Sudan bases its legal code on Islamic Sharia law, and al-Bashir often seeks to burnish his religious credentials.

Last year, he vowed to lead a jihad, or holy war, against U.N. peacekeepers if they deployed in the Darfur region of western Sudan. He relented this year to allow a U.N.-African Union force there, but this month said he would bar Scandinavian peacekeepers from participating because newspapers in their countries ran caricatures of Prophet Muhammad last year.

Associated Press Writer Mohamed Osman contributed to this report.