The youngest-ever minister in the Church of Scotland hopes he can inspire others to join a ministry facing a lack of young recruits partly blamed on the gay clergy controversy.

The Reverend Michael Mair, 25, said he is looking forward to leading his own congregation at St David's Church, in Broomhouse, Edinburgh.

He joined the presbytery there during a ceremony last night.

At last year's annual gathering of the General Assembly in Edinburgh, concerns were raised over the "dearth" of new ministers coming through the system.

One leading academic said the gay clergy row was putting off potential candidates from joining the Church.

The Rev Mair said: "The General Assembly last year heard about the dearth of young people becoming ministers.

"My ordination means I will become one of a handful of ministers under the age of 30.

"I hope my ordination can inspire other young people to think about the ministry or even for elders just to get more involved in the lives of their church."

The Kirk has struggled over allowing gay clergy after the appointment in 2009 of openly gay ­minister the Reverend Scott Rennie to a church in Aberdeen.

Last year the General Assembly voted to allow actively gay men and women to become ministers.

Attracting younger people is a key target for the Church after a report showed that the average age of those training for any form of ministry is 46.

At the General Assembly, the Kirk's Ministries Council warned that unless there are wider "radical and deep-seated" changes the Church will continue to struggle to attract young ministers, at a time when there were more than 200 preaching vacancies.

It was revealed that even with an optimistic prediction, 320 of the serving 845 ministers around Scotland would be retired by 2023.

Just 13% (113) of the 845 ministers were born after 1967; only three of those are under 30.

The Very Reverend Albert Bogle addressed the "need for new blood" to come into the ministry during his year as Moderator of the General Assembly of the Church of Scotland in 2012.

He said there is possibly a need to establish a bursary support scheme to encourage congreg-ation members and others to come forward for ministry.

A graduate of New College in Edinburgh, Mr Mair was ordained at a service preached by the Rev John Cowie at St David's Church

The Rev Ian Gilmour, the Moderator of the Presbytery of Edinburgh, ordained Mr Mair into the ­Presbytery of Edinburgh, making him the new minister of the church.

The Rev Dr George Whyte, Presbytery Clerk of Edinburgh, also took part in the service.

After graduating, Mr Mair spent time as a trainee minister at Wardie Parish Church in Edinburgh.

He helped provide pastoral support for patients at the city's Western General Hospital as part of the chaplaincy team, and was a probationary minister at Dalmeny, linked with Edinburgh Queensferry Church.

He also has ministry experience in Culloden, the Shetland Islands and in the Church of Scotland's Presbytery of Europe.