David Cameron has clashed with the president of Sri Lanka as he pushed for action to protect the rights of its minority Tamil community.
Downing Street said the PM "pressed his points very directly and robustly" in an hour-long meeting with Mahinda Rajapaksa at a Commonwealth summit.
Mr Cameron's convoy was earlier mobbed by demonstrators on a visit to the north of the country.
Mr Rajapaksa says he has brought peace and stability to Sri Lanka.
The Tamils' treatment at the end of the country's civil war in 2009 has dominated the run-up to the the Commonwealth Heads of Government Meeting (Chogm), taking place in the capital Colombo.
Mr Cameron has insisted there should be a proper investigation into alleged Sri Lankan war crimes in the final months of the conflict, saying a process of "truth-telling" was essential for reconciliation.
In a historic move, Mr Cameron travelled to the Tamil-dominated north of the country - the first international leader to do so since Sri Lankan independence in 1948 - before holding face-to-face talks with the country's president.
At one point, the PM's convoy was surrounded by more than 200 protesters holding pictures of loved ones who they claim were killed by the Sri Lankan armed forces or have disappeared.
Mr Cameron said the visit - in which he also toured a temporary refugee camp and newspaper office whose printing presses have been burnt - had "drawn attention to the plight" of the Tamil minority in the country.
He said the first-hand accounts he had heard of journalists who have been attacked and of a young woman who had grown up in a refugee camp would "stay with him" for a long time.
Mr Cameron said staging the summit in Sri Lanka had already resulted in positive changes, but the authorities needed to do much more to show they respected human and political rights.
"The fact is about this country that there is a chance of success because the war is over, the terrorism has finished, the fighting is done," he said.
"Now what's needed is generosity and magnanimity from the Sri Lankan government to bring the country together.
"And I think coming here, listening to these people, hearing these arguments, helps to draw attention to their plight. I think the spotlight has been shone on Sri Lanka and people can see the good and the bad."
The BBC's political editor Nick Robinson, who is travelling with Mr Cameron, said several protestors had been thrown to the floor by police as they tried to approach the prime minister's vehicle with photographs of relatives "disappeared" in the civil war and petitions.
He stressed that the demonstration had not been violent, but the prime minister had been made "fully aware of their grievances and their grief".
The UK prime minister has defied calls for him to boycott the Commonwealth summit in protest against alleged human rights abuses.
President Rajapaksa rejects accusations of rape, executions and indiscriminate shelling, saying the end of the war had brought peace, stability and the chance of greater prosperity to the country.
But campaigners have said an international investigation is needed into the bloody conclusion to the civil war, in which UN estimates some 40,000 people were killed.
"The Sri Lankans have got their own domestic process, but frankly it's fatally flawed and it's not going to deliver any real justice to the people who were killed," David Mepham, UK director of campaign group Human Rights Watch, said.
"The other thing, which is equally important, is that there needs to be real pressure on the ongoing human rights issues. This isn't just a problem of the past."
The prime ministers of Canada, India and Mauritius are staying away from the summit in protest over the allegations.
Gordon Campbell, the Canadian High Commissioner to the UK, told the BBC that Sri Lanka had "turned its back on the very principles that the Commonwealth espouses".
The Labour Party said Mr Cameron's presence was a "reward" for the Sri Lanka president.
"There was a naivety about the British government's approach to this summit," shadow foreign secretary Douglas Alexander said.
"The scale of the suffering has not been challenged in the way it should have been in past months."
The prime minister has dismissed Labour's call for a boycott as "rank hypocrisy", pointing out it was his predecessor Gordon Brown who originally agreed the summit venue in 2009.
The Prince of Wales, who celebrated his 65th birthday on Thursday, is representing the Queen at the biennial event which he opened earlier.
Prince Charles told the summit: "Each one of us is here because of the hope and trust we place in the Commonwealth to bring that 'touch of healing' to our troubles and deliver the very best future for our people."