(CBS) — House Speaker Ryan said he isn’t comfortable with the separation of children and parents who come across the U.S. border. He made the comments in response to questions about the Trump administration’s immigration policy from CBS News’ Nancy Cordes at his weekly press conference on Thursday.

“Mr. Speaker, are you comfortable with the current ‘zero tolerance’ policy leading to parents and children being separated,” Cordes asked. “No I am not,” the speaker replied.

Ryan avoided directly criticizing the White House’s “zero tolerance” policy, which allows border security agents to separate the children of immigrants trying to enter the U.S. illegally, and instead blamed the practice on a court decision.

“What’s happening at the border and the separation of parents and their children is because of a court ruling. That’s why I think legislation is necessary,” said Ryan.

It was not immediately clear what specific court ruling Ryan was referring to, but the case Flores v. Meese, a 1997 class-action lawsuit filed against the Immigration and Naturalization Service (INS) over its handling of unaccompanied illegal minors, appears to be a sticking point among Republicans.

Sen. Chuck Grassley, R-Iowa, tweeted after Ryan’s press conference that he wanted to stop the separation of families by “repealing the Flores 1997 court decision.” The INS’ settlement of the suit resulted in new policies for detaining unaccompanied children.

The Trump administration, however, now separates all undocumented immigrants caught at the border from children traveling with them in the hopes it will discourage future border-crossers from entering the U.S.  Attorney General Jeff Sessions has claimed the practice is “necessary” to deterring illegal immigration.

Sessions warned, “If people don’t want to be separated from their children, they should not bring them with them. We’ve got to get this message out. You’re not given immunity. You have to, you will be prosecuted if you bring, if you come illegally. And if you bring children, you’ll still be prosecuted.”

When families enter the country illegally, the Department of Homeland Security (DHS) can only keep children for 72 hours. After this, DHS continues to oversee prosecution of the parents, while their children then come under the management of the Department of Health and Human Services. The separations and detentions have sparked outrage over the government’s handling of children at the border, fueled by the accounts of lawmakers who attempted to tour the the facilities for themselves.

Ryan said the best way to correct the problem is through legislation, but he gave no indication of what that legislation might look like or when it would be ready.

“We don’t want kids to be separated from their parents, I just made that really clear. And we believe because of the court ruling this will require legislative change,” added Ryan.

His comments come as Republicans aim to vote on two competing immigration bills next week in the hopes of providing a lasting fix to the Deferred Action on Childhood Arrivals program, or DACA, for those who came to the U.S. as children. President Trump ordered the Obama-era program to be rolled back last year.

CBS News’ Nancy Cordes, Rebecca Kaplan and Emily Tillett contributed to this report.