Rev David Latimer’s relationship with the then deputy first minister caused a rift amongst his congregation in the First Derry Presbyterian Church.
Up to 30 families could not accept his decision to “reach out” to the former IRA leader, who died in 2017.
Some who left the church had lost loved ones at the hands of the IRA.
Speaking to BBC Radio Foyle, Rev Latimer said that he was retiring with a “heavy heart”.
Reflecting on his relationship with Mr McGuinness and the controversy it caused, he said: “You’ll never take everybody with you, but if you were to wait until all the ducks were in a row you would end up doing nothing.”
“There was a hand that was guiding and a heart that was planning.
“That was the hand and the heart associated by the maker of us all – Catholic, Protestant, atheist, agnostic, black, white, republican, loyalist, and I look back and I see what I could never have imagined – meeting a man named Martin McGuiness and Martin McGuiness meeting me.”
The pair became friends in 2006 when Rev Latimer asked Mr McGuinness for help as his church, which overlooks the Bogside, was being attacked by paint.
“We clicked and I believe maybe that was the reason I came to this city.”
The 68-year-old has always insisted that he has no regrets about the friendship.
He said on Friday: “If you weren’t persuaded within yourself that you were doing the right thing, you’d have thrown the towel in.
“But Martin used to say to me: ‘David, you haven’t changed your direction. You’ve kept faith with the path that you’re on’.
“It has been said the best relationships you can be in are the ones you never see coming. Neither him nor me saw a relationship coming. We were total opposites.”When he first arrived in the city in 1988, his church was “wrapped in a blanket of security”, he said.
“Wire mesh fencing all around it – the centre door into the church with an outer steel door”.
“People said that’s an ‘old man church’ that a young man is going to,” he added.
Rev Latimer spoke at the Sinn Féin ard fheis (conference) in Belfast in 2011, while, in 2017, he addressed mourners at Mr McGuinness’ funeral.
In 2018, the minister caused added controversy amongst his congregation when he took part in the baptism of the child of a same-sex, mixed religion couple.
He said at the time: “We have to be aware that this does tear families apart and I could have said ‘no way’, but the priest and I chatted and we agreed to baptise the child in a Catholic church and I was there representing the Presbyterian family.”
He explained that the grandparents of the child later told him that they no longer felt “ostracised” as a result of the blessing.
In April, Rev Latimer asked people to support a letter he had written to political leaders following the death of journalist Lyra McKee.In the letter, he urged Northern Ireland’s politicians to enter talks with “open minds and willing hearts”.
Ms McKee was shot dead while observing a riot in Creggan on Thursday, April 18 while observing a riot .
He said the journalist’s death “compels us to plead with our politicians to put people before party”.
“Lyra’s death has, sadly, opened a window, a door through which our politicians must now walk,” Rev Latimer said.
“By lending their name to the letter, people are telling politicians that we are behind them and will be behind them until they get the right result.”