The 1983 Bermondsey byelection, which took place 30 years ago this Sunday, was probably the dirtiest, most violent election in Britain in the 20th century and definitely the most homophobic election in British history. Standing as a leftwing Labour candidate who was pro-gay-rights and anti-racist, I was savaged by the tabloids and became a magnet for every right-winger, homophobe and fascist. The constituency was plastered with three foot-high hate graffiti, including "Tatchell is queer" and "Tatchell is a n****r-lover".

I was assaulted more than 100 times while canvassing, including being spat at, punched and kicked. There were more than 25 attacks on my flat, two attempts by car drivers to run me down, and a bullet was posted through my letterbox in the middle of the night. I received hundreds of hate letters, including threats to kill me and firebomb my flat. Every night, I went to bed in fear of attack. It was like living through a low-level civil war. There were moments when I thought I might be killed.

The Bermondsey byelection was also one of the worst examples of tabloid harassment, intrusion and fabrication. Reporters rifled through my rubbish bins, put my flat under 24-hour long-lens surveillance, sent young boys to my door and posed as a cousin of mine to win the confidence of neighbours and pry information from them. The Sun published a fabricated story in which I had deserted local constituents to attend the Gay Olympics in San Francisco. A photo was published by the News of the World that made me look like I had plucked eyebrows and was wearing lipstick. Many commentators remarked that I was subjected to more sustained press and public vilification than any parliamentary candidate since the 19th century.

The byelection was a pivotal moment in Labour party history. Although democratically selected as the Labour candidate in 1981, the party's national executive committee refused to endorse me for more than a year. The Labour leader, Michael Foot, had been goaded into blocking my candidature on the grounds that I had advocated mass nonviolent protests against Tory misrule. He later admitted to me that he had been also blackmailed by rightwing Labour MPs who had threatened to defect to the breakaway Social Democratic party if he didn't stop the rise of the Labour left. The right demanded my scalp. When the local party refused to dump me, Foot eventually relented – but only a few weeks before the election was due.

During the campaign, I was denied the full support of the Labour election machine. Only a dozen party full-timers were seconded to help me instead of the usual 60 to 90. Some Labour rightwingers wanted me to lose in order to strengthen their bid to ditch leftwing policies that had been approved by the grassroots members at party conference.

Although it was never my intention, I became a symbol of the struggle between the left and the right in the battle for Labour's soul. Critics denounced me for supporting policies that are now mainstream: a national minimum wage, comprehensive anti-discrimination laws, devolution, gay equality and a negotiated political settlement in the north of Ireland. I was pilloried for my opposition to the Tory government's autocratic London Docklands Development Corporation, which gave property speculators a free hand to carve up the north Southwark, Bermondsey and Rotherhithe riverside areas for office blocks and luxury flats.

When I warned about the rip-off redevelopment of the riverside I was called a scaremonger and liar, but my predictions later came true – most local working-class people lost out. This bourgeoisification at the expense of local people is continuing at the western end of the Bermondsey constituency where I still live, in the same one-bedroom council flat as in 1983. There are plans to redevelop the 22-acre Heygate Estate site at the Elephant and Castle. After forcing out 3,000 council tenants, of the 2,535 new homes only 79 will be available to rent as social housing. Helping reverse this social cleansing is the next big battle.

My electoral defeat in 1983 was a symbolic defeat for the whole left; paving the way for the eventual triumph of Blairism and New Labour – and my consequent gut-wrenching departure from Labour to the Greens. On the positive side, public revulsion against the homophobic abuse that I suffered ensured that when Chris Smith MP came out the following year, few people dared attack him. Indeed, after Bermondsey, mainstream parties mostly hesitated to use homophobia as an election weapon. Bravo!