This past weekend, we all saw massive public outrage in major cities throughout the country. It was directed at the Jan. 27 issuance of an executive order, signed by President Donald Trump, addressing immigration. With the executive order, the president ordered the suspension of entry of all refugees to the United States for 120 days, as well as anyone from Syria for an indefinite period and anyone from Iran, Iraq, Libya, Somalia, Sudan and Yemen for 90 days.

The crowds of protesters, which included members of Congress, called the president a tyrant. The president argued that he was lawfully protecting the country from those who might facilitate terrorist attacks here. Can he legally do this?

Here is the back story.

The Constitution expressly gives Congress the power to regulate naturalization, which is the process of becoming an American citizen. It does not expressly give it the power to regulate immigration, which is the process of legally entering the country. From 1776 to 1882, Congress recognized this distinction by staying largely silent on immigration, and thus, anyone could come here from anywhere, with the only real regulation being for public health.

In 1882, Congress gave itself the power to regulate immigration, contending that although the Constitution was silent on the issue, the concept of nationhood gave Congress the ability to regulate the nation's borders and thereby control who was permitted to enter from foreign countries and under what circumstances.

In response to economic competition from Asian immigrants in California -- and in the midst of anti-Asian racial animus -- Congress passed the Chinese Exclusion Act of 1882, which limited the number of immigrants from China for 10 years. In 1892, Congress extended the law for another 10 years, and in 1902, Congress made the law permanent. In 1924, Congress passed the Johnson-Reed Act, which restricted entry into the United States through quotas with respect to national origins. The quotas were capped in 1929, reduced in 1943 and substantially expanded in 1965.

In 1952, Congress passed the Immigration and Nationality Act, which expressly authorized the president to suspend the immigration of any person, class of people or group of people into the United States for public health, public safety or national security reasons.

The courts have upheld this presidential power because under our system, immigration materially affects the nation's foreign policy and foreign policy is constitutionally the domain of the president -- with Congress' role being limited to the senatorial confirmation of treaties and ambassadors and to authorization of money for the president to spend. Yet the courts have limited the president's exercise of this power so that he cannot base it on First Amendment-protected liberties, such as the freedoms of speech, religion and association. So he cannot bar an immigrant because of the immigrant's political views, religion or colleagues.

In 1979, President Jimmy Carter exercised this presidential power to bar anyone from Iran from entering the country until the hostage crisis was resolved. In 2011, President Barack Obama used this presidential power to bar anyone from Iraq from entering the country for six months.

Enter President Trump.

As a candidate, Trump promised that he would secure the nation's borders from those whom he deems harmful to national security for limited periods of time -- at least until he and those under him could determine a more accurate mechanism for separating the true refugees from the ones seeking entry for nefarious purposes. On his eighth day in office, he did just that.

The reaction was swift, loud and seemingly everywhere as foreign-born people, many with green cards and visas, were stopped and detained at the nation's international airports last Saturday. Over the weekend, federal judges in New York City, Boston, Virginia and Seattle ruled that Trump's order could not apply to green card holders or those who received valid State Department-issued visas based on the pre-executive order protocol.

To its credit, the government recognized that the language of the executive order needed to be clarified because green card holders, no matter the country of origin, have the same right of exit and entry as citizens. Moreover, the government cannot constitutionally give anyone a benefit -- such as a visa -- and then nullify the benefit because it changed the issuing standards afterward. So the Trump changes can be prospective only.

Where does this leave us?

Expect numerous challenges in Congress and in the courts to Trump's order because, the challengers will argue, though its stated purpose was not to bar a religious group, its effect is largely to bar Muslims. For sure, the courts will address this. The purpose/effect distinction -- which exists in many areas of the law, such as school desegregation, legislative apportionment and voting rights -- has not been accepted by the courts against a president for a temporary immigration ban because the courts have often deferred to presidents on foreign policy.

Is the ban just?

Everyone knows we are a nation of immigrants. Three of my grandparents immigrated here as children. Most people recognize that all people have the natural right to travel, which means they can seek entry here; but the country has accepted the ideas that our borders are not open, that the welfare state here is not without financial limits and that in perilous times such as today, immigration is largely and legally in the hands of the president, whether one has voted for him or not.

Yet like all governmental powers, particularly those that often clash with natural rights when they are exercised, the power to regulate immigration must be exercised narrowly. Many reading this are here because someone left another country for the freedoms that are respected here. Those freedoms are natural to everyone and will always draw people here.

The government can only morally and constitutionally interfere with personal freedom for the most compelling of reasons and utilizing the least restrictive means. Is the government faithful to that well-recognized rule? We shall soon see.