While Republican presidential candidate Donald Trump's call for a "total and complete shutdown of Muslims entering the United States" has drawn ire from both ends of the political spectrum as being out of step with American values, history tells a different story.

Here are five examples of the U.S. — and Canada — excluding immigrants based on their race, nationality or disability.

1. Chinese Exclusion Act of 1882

The first page of the Chinese Exclusion Act of 1882. (U.S. National Archives and Records Administration)

The first major law restricting immigration to the U.S. was the Chinese Exclusion Act, which barred all Chinese people from entering the United States.

Signed into law on May 6, 1882, the act came amid outcry from American-born citizens that Chinese workers were to blame for the high unemployment and declining wages plaguing the West Coast.

Not only did the law bar Chinese immigration, but it also prevented Chinese people already living in the country from gaining citizenship.

The law, originally written to last 10 years, was repeatedly amended and extended until its repeal in 1943, when China became an ally against Japan during the Second World War.

2. Immigration Act of 1917

This U.S. federal law was the first to restrict immigration to those who could pass a literacy test.

It also banned all immigration from the so-called "Asiatic Barred Zone," which encompassed India, Afghanistan, Persia (now Iran), Arabia, parts of the Ottoman Empire and Russia, Southeast Asia and the Asian-Pacific islands.

Furthermore, it expanded an already existing category of barred "undesirables" to include sex workers, criminals, alcoholics, political radicals, contract labourers, "idiots, imbeciles, and [the] feeble-minded," people with epilepsy, tuberculosis or contagious disease, as well as anyone else deemed "mentally or physically defective."

3. Chinese Immigration Act of 1923

The United States wasn't alone in discriminating against Chinese immigrants.

In Canada, the federal government imposed a $50 head tax on Chinese immigrants in 1885 after Chinese workers were no longer needed to work on the Canadian Pacific Railway. The amount was raised to $500 in 1903, the equivalent of about two years' wages at the time.

Former prime minister Stephen Harper greets Chinese head tax survivor James Pon in Ottawa on June 22, 2006, during a ceremony announcing the government's official apology for the tax. The head tax was imposed on Chinese immigrants to Canada from 1885 to 1923 and was a considerable hardship at the time. (Tom Hanson/Canadian Press)

On July 1, 1923, the head tax was replaced by the Chinese Immigration Act, which barred any Chinese immigrants — or ethnic Chinese people of other nationalities — from entering the country. There were some exceptions for merchants, diplomats and foreign students with proper documentation.

Canada also cast suspicion on those already living here, forcing all people of Chinese origin or descent to register with authorities and to obtain an identity certificate.

The act remained in effect until 1947.

4.Immigration Act of 1924

In this 1938 photo, prospective immigrants line up outside the U.S. consulate in Vienna after the German annexation of Austria. American Jews struggled to get refugees out of Nazi-era Europe due to strict immigration quotas in the U.S. (Museum of Jewish Heritage/ Franklin D. Roosevelt Presidential Library/Associated Press)

In an attempt to stem the tide of eastern European immigration to America, the U.S. enacted a quota system, stipulating that visas be provided only to two per cent of the total number of people of each nationality in the United States as of the 1890 national census.

Because so many eastern Europeans moved to the U.S. in the decades leading up to the First World War, lawmakers opted not to use the more recent census of 1910 to calculate the quotas.

The act also barred entry to "any alien who by virtue of race or nationality was ineligible for citizenship" — a provision aimed at the Japanese.

The effects of the quota system were particularly devastating for European Jews, who struggled to obtain visas leading up to the Second World War and the Holocaust.

5. 'Excessive demand' on health care

The Canadian Immigration and Citizenship Act states "a foreign national is inadmissible on health grounds if their health condition might reasonably be expected to cause excessive demand on health or social services."

This wording has been used to bar entry of people with illnesses or disabilities.

In 2011, a South Korean family living in New Brunswick faced deportation because their teenage son is autistic. The deportation order was later reversed amid public outcry.

Again in 2012, the National Post reported that a University of Victoria professor from the U.S. and his family were denied permanent residency in Canada because of their four-year-old son's autism.