The president of the University of Pennsylvania, Elizabeth Magill, resigned on Saturday, four days after she came under fire for her responses at a congressional hearing on Tuesday in which she was pressed, along with the presidents of Harvard and M.I.T., on whether students calling for the genocide of Jews should be disciplined.

Ms. Magill seemed to evade the question and drew intense criticism from donors, students and others, some of whom were already angry that she had allowed a Palestinian writers conference to be held on campus in September.

Ms. Magill is the first president of a major university to step down because of the fallout from the protests that have engulfed campuses since the Oct. 7 Hamas attacks on Israel and the subsequent war in Gaza.

Here is some background on her decision.

At a hearing of the House Committee on Education and the Workforce on Tuesday, Ms. Magill testified alongside Claudine Gay, the president of Harvard, and Sally Kornbluth, the president of M.I.T. They all said they were appalled by antisemitism and were taking action against it on campus. When asked whether they supported the right of Israel to exist, they answered yes without equivocation.

The three university presidents testified that recent protests on their campuses had grown ugly, with clashes between students supporting Israel and those supporting Palestinians.

But on the question of disciplining students for statements about genocide, they gave lawyerly responses involving free speech.

Free speech groups said they were legally correct. But for many Jewish students, alumni and donors, the statements by the university leaders failed to clearly and forcefully condemn antisemitism.

Representative Elise Stefanik, Republican of New York, said that students had chanted support for intifada, an Arabic word that means uprising and that many Jews hear as a call for violence against them.

She asked, “Calling for the genocide of Jews, does that constitute bullying or harassment?”

Ms. Magill replied, “If it is directed and severe, pervasive, it is harassment.”

Ms. Stefanik responded, “So the answer is yes.”

Ms. Magill said, “It is a context-dependent decision, congresswoman.”

Ms. Stefanik replied: “That’s your testimony today? Calling for the genocide of Jews is depending upon the context?”

Ms. Gay and Ms. Kornbluth made similar statements to those made by Ms. Magill.

Ms. Magill’s remarks set off a wave of criticism, including from Pennsylvania’s governor, Josh Shapiro, and its two senators, John Fetterman and Bob Casey, all of whom are Democrats.

Ms. Magill apologized on Wednesday evening for her testimony.

“In that moment, I was focused on our university’s longstanding policies aligned with the U.S. Constitution, which say that speech alone is not punishable,” she said in a video. “I was not focused on, but I should have been, the irrefutable fact that a call for genocide of Jewish people is a call for some of the most terrible violence human beings can perpetrate. It’s evil — plain and simple.”

She added, “In my view, it would be harassment or intimidation.”

On Friday, more than 70 members of Congress signed a letter demanding Harvard, M.I.T. and Penn’s boards “immediately remove” the three school presidents, who attended the hearing, and “provide an actionable plan to ensure that Jewish and Israeli students, teachers and faculty are safe on your campuses.”

One of Penn’s donors who has criticized the school’s response to antisemitism on campus and Ms. Magill’s testimony, hedge fund manager Ross L. Stevens, also had said that he would pull back a donation to the school worth approximately $100 million.

By Saturday, more than 26,000 people had signed a petition opposing her leadership.

After she resigned as president, Scott L. Bok, the Chair of the Penn Board of Trustees, said in a statement that Ms. Magill will serve as Penn’s leader until the university settles on an interim president and that she will remain a faculty member in the law school.

Mr. Bok also announced his resignation on Saturday, shortly after Ms. Magill’s announcement.

Ms. Magill, a lawyer and a champion of free speech, became the university’s president in July 2022.

Before accepting the position, she served as executive vice president and provost at the University of Virginia, and before that as a professor and dean at Stanford Law School.

Before joining Stanford, Ms. Magill, who grew up in Fargo, N.D., was a professor and vice dean at the University of Virginia School of Law, where she also received her law degree.

After obtaining her bachelor’s degree in history at Yale University, Ms. Magill, a scholar of administrative and constitutional law, served as a senior legislative assistant for energy and natural resources for Senator Kent Conrad. After graduating law school, Ms. Magill clerked for several judges, including Justice Ruth Bader Ginsburg of the United States Supreme Court.

Over the summer, donors had asked Ms. Magill to cancel a planned Palestinian literary conference on campus, citing a range of speakers who they considered objectionable. Ms. Magill, citing free speech, said that it would go on in September as planned.

In response to the objections, Ms. Magill met with students, faculty and campus organizations, and pledged to increase training in antisemitic awareness and to bolster security during Rosh Hashana and Yom Kippur.

On Oct. 7, Hamas attacked Israel, and some of the university’s largest benefactors were furious with what they said was Ms. Magill’s slow response in issuing a statement condemning the attacks.

On Oct. 10, Ms. Magill issued her first statement condemning the Hamas assault, which some critics said was insufficiently forceful. In the weeks after, the university issued a series of statements, including a stronger condemnation of Hamas.

These statements also faced criticism, including from some pro-Palestinian alumni who wrote in a letter on Oct. 18 that Ms. Magill’s statements “failed to recognize the significant suffering and loss of Palestinian life.”

Stephanie Saul and Anemona Hartocollis contributed reporting.