Egypt's Al-Azhar university on Monday overturned a decision to expel a female student who was filmed hugging a male colleague, after the country's top Muslim cleric intervened in her favour.
In a video widely circulated earlier this month, a man was seen carrying a bouquet of flowers kneeling before a woman and then hugging her in what was to be a marriage proposal.
Al-Azhar decided on Saturday to expel the young woman, but two days later the institution's grand imam, Ahmed al-Tayeb, urged the disciplinary board to "reconsider the punishment".
Tayeb cited the student's young age and her educational future, although he said her conduct outside campus was "unacceptable" and unbecoming for "religious and oriental traditions".
Al-Azhar is the most prestigious seat of Sunni Islamic learning in Egypt.
Following an urgent meeting on Monday, the disciplinary board scrapped its earlier decision and instead ruled that the student should be prevented for taking the first half of her exams.
The reversal came after the student "expressed deep regret for what was done, and pledged to abide by the students ethics and the values of society," according to a statement.
The viral video was not shot at Al-Azhar, but at the Mansoura University in northern Egypt where the man filmed is a student.
He was expelled for two years over the footage, university spokesman Hany Helal said, although he can appeal the decision.
On Sunday the young man was interviewed by telephone by a prominent television talk show host on channel MBC Masr, and said that he had brought the bouquet of flowers to propose to the woman.
"We were supposed to be engaged but after what happened her parents are refusing this completely," said the young man, a first year law student who was identified only by his first name Mahmoud.
Egypt, a predominantly Muslim country, is a largely conservative society.
Al-Azhar is touted as standing for Islamic moderation, but critics often accuse the institution of failing to modernise its teachings in order to counter extremism.