The events that culminated in the resignation of Bora Zivkovic from Scientific American last week demonstrate that women in science face a long struggle to root out sexism

Martin Luther King once said, "On some positions, Cowardice asks the question: 'Is it safe?' Expediency asks the question: 'Is it politic?' And Vanity comes along and asks the question: 'Is it popular?' But Conscience asks the question: "Is it right?"

In the past couple of weeks I've been wrestling with my conscience over a number of exchanges in the science blogosphere. I've asked myself the question, to join in or not to join in? I know how hard it is for women to put their head above the parapet and I am keenly aware of the nasty cyber-stalking that many women have received as a result. This is never far from the back of my mind when I tweet. Perhaps there's something about the internet that encourages the constant machine-gun-fire riposte and the seemingly wilful inability to mutually comprehend.

The first worrisome event was a conversation on Twitter between two broadcasters: Sue Nelson and Dara Ó Briain. It was sparked by an article in the Daily Telegraph in which Nelson expressed her concern that most science shows on British TV can only be described as "a laddish, macho presenting culture".

ScienceNelson: the piece actually stated your professionalism not in doubt. This issue is not personal but it is important. And many agree

daraobriain: Not personal? I'd read that first paragraph again, then. And look at the photo. And the front cover.

ScienceNelson: Photos nothing to do with me nor front cover.

daraobriain: And that first paragraph? And the related references to "laddishness"? Blaming the subs for that, too?

ScienceNelson: Err … Do you not know a sub's job? Intro using words laddish and macho was written by sub – not me. Working. Later …

daraobriain: wow, your go-to stance is always to be patronising! Nice work!

ScienceNelson: And your go to stance is sarcasm and aggression. That's enough. You've proved my point perfectly. Signing out.

After what she described a "bruising and disappointing" exchange Nelson responded to him on her blog: "So if you believe that these particular 'lads' science' formats aren't overused and male-dominated or that, when it comes to appearance, women are treated exactly the same as men on TV, that's fine by me. Just don't expect me, or everyone else, to agree with you. Worst of all, don't shout down or belittle others who think otherwise. Our voices should be heard and listened to."

With barely a few days for the internet dust to settle, there then came a much more disturbing encounter last weekend between "The Urban Scientist" and a member of staff at Biology Online. The Urban Scientist is a black female postdoctoral scientist called Danielle Lee who describes herself as using "hip hop culture to share science with general audiences, particularly under-served minority groups". In her writing Dr Lee uses her race as a frame for her science communication activities and has received many honours for her writing.

On being asked to blog by an editor at Biology Online called Ofek, Dr Lee asked if she would be paid and received this retort from Ofek : "Are you an urban scientist or an urban whore?" Biology Online eventually apologised to Dr Lee for the actions of their "recently hired employee" who had been "completely out of line". Ofek is also now out of a job.

But it is other events that flowed from this exchange that are perhaps of more consequence. Dr Lee decided to respond to this racist and sexist comment by posting this article to Ofek on her Scientific American blog. It was immediately taken down by the magazine.

There followed an object lesson on how a major publisher should not respond when it has made a mistake. After taking down the blog, Scientific American then allowed its managing editor to write something in the publisher's defence, and then came a posting from the blog editor Bora Zivkovic explaining that the magazine would have to speak to lawyers over the weekend before they could make any further comment.

No one could have expected the repercussions from this statement. In refreshing solidarity for Dr Lee, another writer and playwright Monica Byrne, outraged by Zivkovic's response, "outed" him as having sexually harassed her during a business meeting by making inappropriate comments, followed by an unwelcome advance via Facebook. This was remarkable and very brave because, in the world of science communication, Zivkovic was a leader who could make or break careers.

It was as if Byrne's statement opened a dam and women began to tweet about their experiences of men in the world of science. Shocking, sad and moving stories.

Zivkovic posted an apology to Byrne in which he said he was "very ashamed" of what had happened. "I hope to be known for my continued professional and appropriate support of science writers rather than for this singular, regrettable event for which I am deeply sorry," Zivkovic wrote.

He also apologised on Twitter, and on Friday he resigned from Scientific American.

Guardian blogger Martin Robbins has been critical of Scientific American for its handling of the incident. "Staff at Scientific American were aware of a problem back in 2012, but kept it close to their chests. Private apologies were issued, wrists were quietly slapped, and a toxic status quo was preserved for another year," he wrote.

Last week I chaired an all-women panel at an event at City University London celebrating the achievements of Ada Lovelace and we all took a moment to discuss how far we women had come.

Yet I can't help wondering how long it will take for the few women in our modern medium of cyberspace to change science, an area that as we've seen can be both sexist and racist. And until then we will have to rely on those people who pass the test of Martin Luther King's words: "The ultimate measure of a person is not where they stand in moments of convenience, but where they stand in moments of challenge, moments of great crisis and controversy."