Former US secretary of state Hillary Clinton delivered a impassioned defence of human rights and equality as she received an honorary degree from one of the UK's oldest universities.

Mrs Clinton gave the graduation address at a ceremony to mark the 600th anniversary of the founding of St Andrews University.

It was the politician's first foreign visit since her term as secretary of state ended in February.

Mrs Clinton told an audience of education leaders, university staff and students: "We need more voices speaking up for universal human rights.

"We have honoured some of the great advocates here today who have spoken out courageously for women's rights, gay rights and religious understanding, showing us that our communities and institutions are strongest when equality and opportunity are open to all people and freedom of conscience is respected.

"Here in the home of the Scottish Enlightenment and the great contributions from Scottish universities, we need to be reminded that it paved the way for much of the progress we now take for granted, not only in the West but around the world.

"And it is important that as we chart our way forward in this new century, we bring with it the enlightened view that every individual around the world regardless of gender, religion, race, ethnicity or orientation, should be able to contribute to their societies and to have the chance to live up to his or her God given potential.

"We are confronting deep cultural and political differences. Change can be very wrenching and it is difficult to bridge the gaps between and within societies.

"We will never agree on everything....but spirited and principled debate is the lifeblood of democracies and today our democracies are under stress.

"It is more important than ever that we rally behind what started here and elsewhere, where the individual was endowed by his creator with those rights that enabled first men and slowly women and others to be full participants in their society.

"Now we need in this new age participation on a much grander scale to make the case for the importance of those fundamental values."

Mrs Clinton, who arrived in the Fife coastal town yesterday, was conferred with a doctor of laws degree in recognition of her achievements as a politician and diplomat.

She received the doctorate from the veteran Liberal Democrat politician and chancellor of St Andrews, Sir Menzies Campbell.

The award marked her efforts to champion the causes of education, human rights, democracy, civil society and promoting opportunities for women around the world, the university said.

In her address, Mrs Clinton congratulated St Andrews on its 600th anniversary and paid tribute to the 18 other prominent figures honoured during the ceremony.

"St Andrews has never been a place for calm seas, and that's a good thing," she said. "Because out of the churn and chop arise creativity and excellence.

"Today this is where things begin: teaching that opens the world, research that improves the world, even a love affair that enchants the world."

Honorary degrees were also bestowed on the former Archbishop of Canterbury, Rowan Williams, classicist Professor Mary Beard, inventor of the world wide web Professor Sir Tim Berners-Lee, primatologist Dame Jane Goodall, anthropologist Professor Dame Marilyn Strathern and philosopher Professor Nancy Cartwright.

Mrs Clinton said: "This is not only a retrospective about their great accomplishments individually. This is a call to action as well.

"Their work tells us much about the challenges we face in the 21st century as well as the opportunities that we can and should seize together."

She praised St Andrews for "breaking a barrier" when it became the first of Scotland's oldest universities to be led by a woman.

"It is an important milestone, it is a great symbol, because the equality for women everywhere remains one of the unfinished missions of our time," she said.

The politician concluded her speech by issuing an appeal to the assembled students.

"We look for you to be part of a great movement of young people across our world, who will not settle for the lowest common denominator, who will not give up your right to be heard, who will not take the easy path of conventional agreement with ideas and policies that are neither founded on evidence nor common sense," she said.

"We need you to be in a new vanguard for the kind of changes that we are seeking that will make a difference in this world.

"We cannot succeed without great institutions like St Andrews continuing to speak out, to break barriers, and we cannot succeed without young people who are willing to walk through those openings and help chart a new path for us all."

The former US first lady, who lost to Barack Obama in the contest to be Democratic presidential candidate in 2008, was not accompanied by husband Bill or daughter Chelsea on the trip.

Earlier the Duke of Cambridge congratulated the university on its anniversary in a letter which was read out by Sir Menzies at the beginning of the ceremony.

Prince William, who met his wife Catherine while studying at St Andrews, wrote: "As a proud new father, I have come to think more than ever about the world our children will inherit; and the role of education, research and intellectual courage in our society has never seemed so important.

"For Catherine and me, the University of St Andrews is an emblem of these virtues.

"As proud patron of the Anniversary Appeal, I am delighted to offer my congratulations to all the university's honorary graduates today and my warmest congratulations to an institution that may be 600-years-old but which has never been as vital. Happy birthday, St Andrews."

Sir Menzies also read out a letter from Cardinal Tarcisio Bertone which passed on the congratulations of Pope Francis.

"His Holiness Pope Francis was pleased to be informed of the celebrations marking the 600th anniversary of foundation of the University of St Andrews and he sends cordial greetings to all taking part," the cardinal wrote.

"His Holiness is confident that the noble work of education and research in a wide range of academic fields will continue to flourish in the city that bears the same name of Scotland's patron saint."

St Andrews principal and vice-president, Professor Louise Richardson, said: "We were founded before the printing press, before the battle of Agincourt, before the construction of the Forbidden City in Beijing, before the construction of Machu Picchu in Peru, before Columbus arrived in the Americas and before Joan of Arc waged battle.

"We have lasted this long because of the enduring value of what we do, because we serve as foundations of our democracy as guardians of our culture and engines of our economy and always as generators of new ideas."

Lord Williams was awarded a doctor of divinity degree in recognition of his contribution to the Church and society as a whole.

He joked that the real reason for the award is his "limited but rather public experience in taking the weddings of St Andrews graduates", in reference to the wedding of the Duke and Duchess of Cambridge.

"At a time when tribalism at every level threatens our world, the vocation of the university to promote and sustain that human conversation is greater than ever," he said.

"A universal conversation is difficult by definition. It is difficult because of the way in which it forces us constantly to re-examine where we began. And yet that corporate project of speaking to one another, learning from one another as human beings, is something precious beyond measure.

"I hope and pray that in the 600 years ahead, and for all I know the 1,200 years ahead, this university may continue to promote just that conversation, just the spirit of energy and imagination that have been shown in the last few centuries."

The institution, said to be the third oldest in the English-speaking world, will continue to mark its anniversary when leading thinkers gather to debate the future of universities on Saturday.