Ron Davies, the former cabinet minister and pioneer of Welsh devolution, was last night forced to quit politics after his local party demanded that he stand down following allegations about gay sex.

Mr Davies was told to quit within 48 hours of the demand on Friday or face deselection before the Welsh assembly elections in May. He formally announced his plan to stand down as Labour assembly member for Caerphilly at a press conference yesterday evening.

He said: "It has certainly not been an easy decision. I have been in public life for 34 years. The last seven have been very traumatic."

Last week the Sun newspaper published pictures of Mr Davies leaving a gay sex haunt off the M4 near Bath. At first Mr Davies said he had not been in the area for 15 years, adding that he was happily married and enjoying his baby, who was born last month.

But within hours he admitted he had been in the area after all. He said his initial denial had been based on a confusion, adding: "I have actually been there when I have been watching badgers."

He added: "I had stopped in the car park to go to the lavatory and went for a short walk in an adjacent area of public woodland."

Mr Davies claimed reporters from the Sun had been following him for weeks. Yesterday, he said the last week had been "pretty horrific". "I have become the centre yet again of a media maelstrom because of allegations about my private life."

He said he regretted his handling of the allegations. "I have handled this not very well. In retrospect I should have handled it another way. I don't feel devastated, I feel badly bruised, this has taken a huge toll on me, physically, emotionally and mentally."

Asked about his plans for the future, Mr Davies said: "What I will need to do over the next two or three months is take a little step back. I have to consider what I do. I will have to reflect. There will be things that come out of this. I can spend more time, as politicians say, with my young family."

Mr Davies dramatically quit Westminster politics four years ago after what he memorably described as a "moment of madness" on Clapham Common. Mr Davies had been robbed after seeking gay sex with a stranger.

Eight months after that incident, he admitted he was bisexual, and two years ago he said he had been successfully treated for a compulsion to seek out gay partners. He married for the third time when his second wife divorced him two years ago after a 26-year marriage.

Mr Davies will be remembered by many in Welsh politics as an architect of Welsh devolution who was willing to confront some of the conservative tendencies inside the Welsh party.

Peter Hain, the Welsh secretary and a former close colleague of Mr Davies, described his resignation as a "sad decision", adding: "It's a tragic end to an impressive political career."

Jeff Cuthbert, Caerphilly Labour chairman, had said at the weekend: "We are giving Ron a chance to make his decision but it must be very soon. He has represented us since 1983 and we feel it right to give him time to decide."