The first same-sex church wedding in the UK has taken place in Edinburgh.

Peter Matthews and Alistair Dinnie made history when they were married at St John's Church, run by the Scottish Episcopal Church (SEC).

In June, the SEC voted to amend canon law and allow same-sex couples to be married in church during the church's General Synod in Edinburgh.

The move made it the first branch of the Anglican faith in the UK to allow same-sex marriage and was welcomed by equal rights campaigners.

It came almost three years after the law on same sex marriage came into effect. Susan and Gerrie Douglas-Scott were one of the first couples to get married on December 31, 2014, marrying in a humanist ceremony in the Trades Hall, Glasgow.

But until now, there have been no same-sex wedding ceremonies in a church building.

Mr Matthews and Mr Dinnie's wedding is said to have taken place earlier this month with other same-sex weddings also held in SEC churches in Glasgow and Moray since.

The Rev Markus Dunzkofer, the rector at St John's, told The Times: "I have blessed marriages in other Anglican provinces and always had to stop short of the vows.

"It felt like something was cut off, like something wasn't right.

"Finally being able to do the whole thing felt like the fulfilment of where the spirit had been telling us to get to. It completely made sense, it all came together."

However, it could lead to action being taken against the church by the Anglican Communion, the international association of the world's third largest Christian movement, at a meeting next week.

SEC members voted to remove the doctrinal clause which stated that marriage is a ''union of one man and one woman'', replacing it with a clause which asserts that clergy who do not wish to preside over same-sex weddings will not be compelled to do so ''against their conscience''.

The Secretary General of the Anglican Communion said the SEC's decision puts it ''at odds with the majority stance that marriage is the lifelong union of a man and a woman''.

Last year, the US Episcopal Church was suspended from participating in decision making and prevented from representing Anglicans in meetings with other Christians and faith groups after it backed equal marriage.

Rev Dunzkofer told the newspaper he will pray that Anglican leaders do not take action, adding: "Quite literally, God only knows what will happen."

Mr Matthews and Mr Dinnie are said to be on honeymoon.