Prince William (search) graduated from St. Andrews University on Thursday in a colorful, tradition-steeped ceremony watched by his grandmother, Queen Elizabeth II (search), and father, Prince Charles (search).

Wearing a hood with cherry-red lining to indicate he is a Master of the Arts, the 23-year-old prince knelt before university chancellor Sir Kenneth Dover, who tapped him on the head with a cap.

According to St. Andrews tradition, the cap is sewn from a fragment of breeches worn by Scottish religious reformer John Knox, who preached in the medieval university town in the 16th century.

William, 23, was one of 260 students to graduate in the 4 1/2-hour morning ceremony. Girlfriend Kate Middleton (search) graduated in the same ceremony.

William earned a 2:1 geography masters degree in four years of study. A 2:1 denotes an upper second class degree, a very respectable achievement — and better than Prince Charles' 2:2 from Cambridge.

A Scottish Master of the Arts degree is the equivalent of an undergraduate English Bachelor of Arts degree.

William has said he plans to sign up for military training at Sandhurst, the prestigious military academy south of London where his younger brother, Harry, began his studies last month.