Lawyers for the Gurkhas say the government's policy is discriminatory
Retired Gurkhas have launched their High Court battle for the right to live in the UK.
The test case is being brought by five ex-Gurkhas and the widow of another veteran. Their lawyer said Britain owed "a special debt" to all Gurkhas.
Gurkhas who retired from the British Army after the regiment moved its main base from Hong Kong to the UK in 1997 have automatic permission to remain.
But those who left earlier must apply and can be refused and deported.
The outcome of the case could affect more than 2,000 retired Gurkhas who have been denied the right to settle in the UK.
At the start of the two-day hearing, Edward Fitzgerald QC, representing the former soldiers and widow, said the government's policy was "indefensible".
He told the judge, Mr Justice Blake, four of those he was representing were refused leave to enter the UK because they lacked strong ties.
Mr Fitzgerald went on: "We submit that the Gurkhas, past and present, all alike have strong ties to this country.
"However distant their country of origin, whatever the location of their headquarters at a particular moment in history, however remote the battlefields on which they fought and risked their lives and shed their blood, all the Gurkha soldiers were fighting for this country.
"Against that background, the continuing exclusion of Gurkha soldiers discharged before 1997 from the Armed Forces Concession was, and is, indefensible."
I want to see justice done
Actress Joanna Lumley
The concession grants the right to settle in the UK to non-UK nationals who have completed four years service in the armed forces.
Under the Home Office's discretionary policy, strong reasons have to be shown for extending the Armed Forces Concession.
The five ex-Gurkhas involved in the test case are L/Cpl Gyanendra Rai, Deo Prakash Limbu, Cpl Chakra Limbu, L/Cpl Birendra Shrestha and Bhim Gurung.
Mrs Gita Mukhiya was a special category, said Mr Fitzgerald, because she could not qualify under the Armed Forces Concession.
He said he hoped the home secretary would review her case in the light of the court's findings.
The case is being paid for by the Legal Services Commission, which said its funding reflects its commitment to "ensuring fair access to justice for those who need it most".
Ahead of the hearing, hundreds of supporters gathered outside London's High Court, including British actress Joanna Lumley, whose father was a Gurkha.
Veterans who retired before 1997 don't qualify for automatic rights to stay in the country
She knelt before two veteran Gurkha Victoria Cross holders in wheelchairs to offer her best wishes in the case.
"I want to see justice done," she told Lachhiman Gurung, 91, and Tul Bahadur Pun, 86, who served with her father during World War II in Burma.
The Gurkhas protested outside the Houses of Parliament on Tuesday and also handed a petition into Downing Street.
Gurkhas have been part of the British Army for almost 200 years. They are hand picked from a fiercely contested recruitment contest in Nepal to win the right to fight for Britain.
Known for their bravery, their close camaraderie and endurance, they have seen combat all over the world, with 200,000 fighting in the two World Wars.
The hearing was adjourned until Wednesday when the Home Office will be defending its immigration policies.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.