The Archbishop of York, John Sentamu, has had an operation for prostate cancer, it was announced on Thursday.

He said he would be out of action for some time but looked forward to resuming his ministry as soon as possible.

In a statement, he said: "I am thankful and grateful for Mr Bill Cross and his surgical team at St James's hospital, Leeds, who operated on me for a locally advanced cancer of the prostate. I am also grateful to the nursing staff who are caring for me. I am thankful, too, for all of you who regularly pray for me and support me, especially my staff at Bishopthorpe Palace."

Sentamu, 63, had not previously announced his illness but spent nearly two weeks in St Thomas's hospital in London after suffering complications following an operation to remove his appendix.

Sentamu, the sixth of 13 brothers and sisters, and a former barrister and judge, moved to Britain in 1974 having fled Uganda, where he was a critic of the dictator Idi Amin.

He has recently spoken out against gay marriage but is not normally regarded as a conservative. In 2007 he cut up his dog collar on live television in a dramatic protest against Robert Mugabe's rule.

He also once pitched a tent and camped in York Minster for a week, fasting in solidarity with the victims of conflict in the Middle East. He has also supported the armed forces – skydiving to raise money for families of servicemen wounded or killed in Afghanistan – and has spoken out against bankers and traders responsible for the financial crisis.

He has called for the English to mark St George's Day properly on 23 April, warning that the failure of England to rediscover its culture would lead only to greater political extremism.

His popularity in Yorkshire was recognised when he was named Yorkshire Man of the Year in 2007.

As Bishop of Stepney in east London, Dr Sentamu acted as an adviser to the inquiry into the murder of Stephen Lawrence. He has also campaigned against guns, knives, drugs and gangs.