Jeremy Christian is the suspect in the fatal stabbing of two men on a Portland light-rail train (Multnomah County Sheriff's Office/AP)A heart-shaped wreath at a memorial for two men who were stabbed to death in Portland (AP Photo/Gillian Flaccus)

Police will examine the extremist views of a man accused of fatally stabbing two men who tried to intervene when the suspect yelled racial slurs at two young women who appeared to be Muslim.

The attack on Friday in Portland, Oregon, happened on the first day of Ramadan, the holiest time of the year for Muslims, and sent shockwaves through a city that prides itself on its tolerance and liberal views.

A memorial where the stabbing occurred grew steadily on Saturday, and a vigil was planned.

"That people feel emboldened to come out and show their racism and bigotry in that way is horrifying to me. It's a gut check for everywhere - and absolutely for Portland," said Christopher Douglas, who stopped at the memorial.

"Portland ... floats in a little bit of a bubble of its own liberal comfort and I think the reality is sinking in."

Jeremy Christian, 35, was being held in the Multnomah County Jail on suspicion of aggravated murder, attempted murder, intimidation and being a felon in possession of a weapon. He was arrested a short time after the attack.

He will make a first court appearance on Tuesday. A phone at his home in Portland rang unanswered on Saturday, and no-one came to the door at his parents' home.

Police identified the victims as Ricky Best, 53, of Happy Valley, Oregon, and Taliesin Myrddin Namkai Meche, 23, of Portland. Mr Best died at the scene and Mr Meche died at a hospital.

Mr Meche's mother, Asha Deliverance of Ashland, Oregon, confirmed on Facebook that her son had been killed.

"He was a hero and will remain a hero on the other side of the veil. Shining bright star I love you forever," she wrote.

Mr Meche graduated last year from Reed College in Portland with a bachelor's degree in economics, the college said.

Mayor Ted Wheeler said Mr Best was an Army veteran and a city employee.

"These two men died heroes as a result of a horrific act of racist violence."

Micah David-Cole Fletcher, 21, of Portland was also stabbed in the attack and is in a serious condition in hospital. His injuries are not believed to be life-threatening.

Police said one of the two young women on the train was wearing a hijab. The assailant was ranting on many topics, using "hate speech or biased language," Sgt Pete Simpson said.

Dyjuana Hudson, the mother of one of the girls, told The Oregonian/OregonLive the man began a racial tirade as soon as he spotted the girls.

Her daughter is African-American and was with a friend who was wearing a hijab, she said.

The FBI are working with Portland police, and say it is too early to decide whether the killings qualify as a hate crime, however Christian is charged with two counts of intimidation, the state equivalent of a hate crime.

Court records show Christian served prison time for first-degree robbery and second-degree kidnapping after a crime committed 15 years ago, while theft and weapons charges were dismissed in 2010.

The Portland Mercury, one of the city's alternative weeklies, posted an article on its website saying Christian showed up at a free speech march in late April with a baseball bat to confront protesters and the bat was confiscated by police.

The article included video clips of a man wearing a metal chain around his neck and draped in an American flag shouting "I'm a nihilist! This is my safe place!" as protesters crowd around him.

Neighbours who live next to Christian's parents' house - which was also his last listed address in court records - said the family was quiet and they often saw Christian's two adult brothers but never him.