The government cannot be held legally liable for abuses during the Mau Mau rebellion against British colonial rule in Kenya, a court has heard.
Ministers want a claim for compensation from four elderly Kenyans struck out by the High Court in London.
The claimants say they were assaulted between 1952 and 1961 by British colonial officers in detention camps.
The Foreign Office says Kenya had its own legal colonial government, which was responsible for the camps.
The armed Mau Mau movement began in central Kenya during the 1950s with the aim of getting back land seized by British colonial authorities.
Thousands of Kenyans involved in the rebellion, or suspected of supporting it, were detained in camps.
The Foreign Office's counsel, Robert Jay QC, told a packed courtroom that it did not seek to diminish the appalling acts committed in camps, but said the case was "built on inference" and ended in a "cul-de-sac".
'So shameful '
The claimants, Ndiku Mutua, Paulo Nzili, Wambugu Wa Nyingi and Jane Muthoni Mara, who are in their 70s and 80s, have flown from their homes in rural Kenya to appear in court.
The judge heard Mr Mutua and Mr Nzili had been castrated, Mr Nyingi was beaten unconscious in an incident in which 11 men were clubbed to death, and Mrs Mara had been subjected to appalling sexual abuse.
Mr Mutua, 78, told the BBC his castration had affected his "psychological being".
"Being a man without a family, without a wife, is so shameful and I live under shame even with my peers," he said.
Standing with his clients on the steps of the High Court on Thursday, Mr Day said they were primarily seeking an apology.
"They were subjected to unspeakable acts of torture and abuse at the hands of British officials in the 1950s and 1960s, including castrations, sexual abuse and repeated beatings," he said.
"The treatment they endured has left them all with devastating and lifelong injuries. There is no doubt that endemic torture took place in Kenya before independence."
Mr Jay, for the foreign secretary, said the role of the regular forces of the British Army was to fight the battle against the Mau Mau in the forests but they played no part in the "screening" activities - a system of interrogation to identify suspects - within the camps.
He rebutted the claim that the liabilities of the colonial administration passed to the UK upon Kenya's independence in 1963.
Mr Jay also argued the case was not valid because of the amount of time that had passed.
Archive searches connected with the case have led to the discovery of thousands of files from former British administrations, including some about the Mau Mau uprising, which are to be made public by the Foreign Office.
David Anderson, professor of African politics at Oxford University, who has examined some of the withheld documents, said the files proved Whitehall not only knew what was being done to Mau Mau suspects but also had a part in sanctioning their ill-treatment.
His witness statement in the case says the papers he has inspected include candid admissions of wrong-doing.
Historians say the Mau Mau movement helped Kenya achieve independence.
Mau Mau fighters have been blamed for crimes against white farmers and bloody clashes with British forces throughout the 1950s.
Tim Symonds, who joined the Kenyan police reserve as a tracker shortly after settling in the country in 1954, says the Mau Mau fighters should also be asked to apologise.
"Why isn't someone saying to these Mau Mau, you want compensation from the British government, OK fine, but why don't you apologise to the 10,000 of your own tribe, the Kikuyu, that you slaughtered?" he said while being interviewed on BBC Radio 4's Today programme.
The Kenya Human Rights Commission has said 90,000 Kenyans were executed, tortured or maimed during the crackdown, and 160,000 were detained in appalling conditions.
An official report in 1961 determined that more than 11,000 Africans, most of them civilians, and 32 white settlers died during that period.