It is the first such lawsuit in Japan, according to the plaintiffs' lawyers, and comes amid a sharp rise in the number of foreign workers coming to the country to help stem labour shortages as its population ages and declines.

It also comes amid a renewed debate over what it means to be and look Japanese, after a Ukrainian-born, naturalised Japanese citizen was crowned Miss Japan last week.

The three men filed the lawsuit with the Tokyo District Court demanding that the national, Tokyo Metropolitan and Aichi Prefecture governments recognise that it is illegal for police officers to stop and question people solely on the basis of their race, nationality or ethnicity.

The plaintiffs say they have suffered distress from repeated police questioning based on their appearance and ethnicity, which they say is a violation of the constitution.

The Tokyo Metropolitan Government, Aichi Prefectural Government and National Police Agency all declined to comment, while representatives of the Ministry of Justice could not be reached.

They and their legal team arrived at Tokyo District Court around midday and spoke to media outside before heading in to file their case.

One of the plaintiffs, Matthew, a man of Indian descent who has lived in Japan for more than 20 years and holds permanent residency, said he had been questioned by police countless times. He said he is afraid to go out for fear of being stopped again.

"I never knew what social withdrawal was until recently," he said, declining to provide his surname for fear of harassment. "I feel like every time I finish work, I'm hiding in my house."

Syed Zain, who was born in Pakistan but took Japanese citizenship after moving to Japan with his family as a child, said he hoped the case would lead to positive change in a society where the number of Japanese with foreign roots is growing.

Likewise, Maurice, an American who did not provide his surname, said he hoped to raise awareness of the issue among Japanese people and make life easier for others.

"I want them (Japanese people) to understand that this is an everyday occurrence, it's an everyday thing, and that we have to do something to prevent that," he said.

The lawsuit also seeks 3 million yen (about $20,250) in damages for each plaintiff.

(Reporting by Chris Gallagher; Editing by Hugh Lawson)

By Chris Gallagher