The U.S. House of Representatives has passed two major bills to protect the rights of certain noncitizens entering the United States.

The bills—the NO BAN Act and the Access to Counsel Act—passed on April 21. They would restrict presidential powers to institute travel bans and ensure access to attorneys for certain people detained at ports of entry, respectively. The bills also would need to pass in the U.S. Senate to become law.

In January 2017, President Trump issued an executive order banning travelers from seven Muslim-majority countries and all refugee admission. U.S. Customs and Border Protection (CBP) detained nationals of the affected countries as they arrived to the United States, including legal permanent residents. Many were not allowed access to attorneys. Thousands of people protested the order at airports around the United States.

A few days after the executive order, the Trump administration announced that lawful permanent residents were exempt from the travel restrictions. Judges struck down two versions of Trump’s travel ban before a third version was allowed by the Supreme Court. President Biden rescinded that version on his first day in office.

In the Immigration and Nationality Act of 1952, Congress gave the president authority to restrict or suspend the entry of noncitizens to the U.S. Congress intended for the president to use this power for urgent situations that threatened public safety. It was not intended to discriminate against travelers based on their nationality or religion. The bills passed recently by the House aim to prevent further misuse of this power.

The first bill is the National Origin-Based Antidiscrimination for Nonimmigrants Act, known as the NO BAN Act. The bill would bar  religious discrimination in certain immigration-related decisions. It would require specific evidence of why a ban is needed to protect national security, public safety, human rights, democracy, or international stability.

The Departments of State and Homeland Security would also have to consult with Congress before instituting a ban and then provide a follow-up report within 48 hours. The bill would also allow people illegally included in the ban to sue in federal court.

The second bill is the Access to Counsel Act. The bill provides protections to U.S. citizens, lawful permanent residents, visa holders, returning asylees, and refugees who CBP subjects to secondary inspection. These people would have the right to consult with an attorney and certain other people within one hour and then as needed throughout the inspection process. The attorney or other consulted person would be allowed to visit, speak on the phone to, advocate for, and provide evidence on behalf of the person in CBP custody.

The day before the bills passed, President Biden issued statements supporting both bills. If they pass the U.S. Senate, he is expected to sign them into law.

The NO BAN Act and the Access to Counsel Act provide important protections to U.S. citizens, immigrants, and visitors. While these protections represent important steps forward, they should go even further.

Long before Trump’s Muslim Ban, CBP was known for denying access to counsel to those in its custody, both at airports and at land borders. The Access to Counsel Act only covers those with valid U.S. travel documents. But many people arriving to our borders, especially asylum seekers, come without any such documents, even though seeking asylum in the U.S. is legal.

All people in CBP custody, regardless of immigration status, need access to attorneys.

Taken together, the bills are an important step toward ensuring that an order like the Muslim Ban—which caused massive turmoil for people across the world—cannot be repeated based on the whims of a president.