CORRECTION: 31/01/2017 -: An earlier version of this story said that Fred Korematsu was born in 1917. That was incorrect. He was born in 1919.

US President Donald Trump's executive order to ban immigrants from seven Muslim-majority countries is being compared to the internment of Japanese Americans during World War II.

Barely two months after the Pearl Harbor attack in 1941, nearly 120,000 people of Japanese ancestry residing on the country's western coast were branded a military threat and put inside internment camps across the country.

But a 23-year-old Japanese American, Fred Toyosaburo Korematsu, defied Executive Order 9066 by President Franklin D Roosevelt and went into hiding instead of voluntarily relocating to an internment camp, where conditions were often harsh.

Korematsu was finally arrested in May 1942 and convicted of defying the government order. He fought the case all the way to the Supreme Court but the top court ruled against him.

READ MORE: Six other times the US has banned immigrants

He was released after the end of World War II but the conviction remained on his record until it was overturned in 1983, by a court that said the internment was racially motivated.

Who was Fred Korematsu?

Korematsu was born on January 30, 1919, in Oakland, California, to Japanese immigrant parents, who moved to the US in 1905.

Google Doodle is marking what would have been his 98th birthday.

OPINION: Fred Korematsu - Why ignore a true hero?

Korematsu was awarded the Presidential Medal of Freedom, the highest civilian honour in the US in 1998.

The then US president, Bill Clinton, said: "In the long history of our country's constant search for justice, some names of ordinary citizens stand for millions of souls. Plessy, Brown, Parks ... to that distinguished list, today we add the name of Fred Korematsu."

Speaking out for Muslim Americans

In the wake of September 11, he spoke out against the dangers of racial profiling Arab Americans and urged US leaders not to repeat the wrongs inflicted upon Japanese Americans.

"... No one should ever be locked away simply because they share the same race, ethnicity, or religion as a spy or terrorist," he said. "If that principle was not learned from the internment of Japanese Americans, then these are very dangerous times for our democracy."

He filed two amicus curiae briefs with the Supreme Court on behalf of American Muslims being held at the notorious Guantanamo Bay prison.

"Certainly after 9/11, it was the Japanese American community and my father that spoke out first when the government talked about rounding up Arab and Muslim Americans and putting them in camps," his daughter, Karen Korematsu, told Al Jazeera in 2014.

Becoming a civil liberties icon

About 70,000 of the Japanese Americans interned during the war were American citizens. Families lost their businesses and homes, and were branded as traitors.

"You had 48 hours to decide what you would take with you. You didn't know where you were going," Karen explained.

OPINION: The militarisation of ' war on terror ' in the US

US President Gerald Ford formally ended Executive Order 9066 in 1976 and offered an apology. "We now know what we should have known then - not only was that evacuation wrong, but Japanese Americans were and are loyal Americans," he said.

The US Congress apologised in 1988. Compensation of $20,000 was paid to each of the victims.

"Fred Korematsu turned his humility and humanity into powerful advocacy on behalf of all of us," writer Barbara Field wrote in an earlier article for Al Jazeera.

By the time Korematsu died in 2005, he had become an icon of civil liberties.

An American story

Unlike the Japanese internment, which elicited barely any public reaction, thousands of Americans have rallied in support of those affected by Trump's decision.

People have been camping out in front of airports across many cities, calling for the release of immigrants detained inside the airports.

"Fear is ignorance," said Karen. "We continue to be a land of immigrants. That's what America means to the world. If we don't set the right example, we can't expect the world to follow suit - especially when we are talking about civil and human rights. As my father said, and I say, this isn't just a Japanese American story. This is an American story."