The company that fired a female tech developer who tweeted about comments she overheard at a Santa Clara conference said in a blog post that “publicly shaming” the men was inappropriate and she had to be terminated for alienating the developer community.

But that firing could be hard to defend in court, say labor law attorneys.

“It’s a tough one,” said Rob Pattison, a San Francisco attorney who represents employers for the Jackson Lewis law firm. “The law is strong in protecting people who make complaints of harassment, or who participate in an investigation about complaints of harassment.”

Adria Richards, a San Francisco “developer evangelist” for SendGrid, an email delivery company, tweeted a photo of a group of men sitting behind her at Sunday’s PyCon conference who made a comment about “big dongles.”

Richards’ tweet set off a social media tsunami with ominous overtones, including threats and name-calling directed at Richards. The fallout led to her firing, as well as the dismissal of one of the men in the photo by his employer, PlayHaven, a San Francisco mobile-game company.

Richards could not be reached for comment by this newspaper. Tech blog VentureBeat said it received an email from Richards on Friday that simply said, “I’m staying safe.”

Richards’ former boss, SendGrid CEO Jim Franklin, wrote on the company’s blog that Richards was fired because “A SendGrid developer evangelist’s responsibility is to build and strengthen our Developer Community across the globe. In light of the events over the last 48+ hours, it has become obvious that her actions have strongly divided the same community she was supposed to unite. As a result, she can no longer be effective in her role at SendGrid. … In the end, the consequences that resulted from how she reported the conduct put our business in danger.”

Franklin said the Boulder, Colo.-based company supports her right to report what she considered to be offensive sexual comments, but her use of social media contributed to her dismissal.

“Her decision to tweet the comments and photographs of the people who made the comments crossed the line,” Franklin wrote. “Publicly shaming the offenders — and bystanders — was not the appropriate way to handle the situation. … Needless to say, a heated public debate ensued. The discourse, productive at times, quickly spiraled into extreme vitriol.”

Therese Lawless, a San Francisco attorney who represents employees in employment and discrimination cases does not know Richards but said Richards would have a “groundbreaking case” if it went to court because her complaint was made on social media.

“I like it,” Lawless said. “She has a case.”

“They’re basically retaliating against her for speaking out about sexual harassment,” Lawless said. “Oftentimes, employers say their excuse is that ‘We want this person out of the workforce because they don’t fit into the culture, they don’t get along with their co-workers.’ But she’s in a situation where she’s speaking about inappropriate behavior.”

PlayHaven seems to be on much more solid ground for firing one of the men in the photo that Richards shot and tweeted out.

Because the incident occurred at a work-related conference, PlayHaven is “certainly well within their rights to terminate that employee,” said Donna M. Rutter, an attorney with the Miller Law Group in San Francisco who represents employers in labor disputes.

Pattison agreed.

“Employers have an obligation to prevent sexual harassment and that sort of behavior in a workplace setting, and this is clearly a work setting that’s related to their jobs,” Pattison said.

A writer who went under the name “mr-hank” claimed to be the man who was fired and posted an apologetic comment on the blog Hacker News that said Richards “had every right to report me to (PyCon) staff, and I defend her position.”

“Let this serve as a message to everyone, our actions and words, big or small, can have a serious impact,” he wrote, adding he was the father of three children. “I will be at pycon 2014, and I will joke and socialize with everyone but I will also be mindful of my audience, accidental or otherwise.”

Beyond any potential court case over Richards’ firing, it’s the social media aspect of her actions that could hold bigger ramifications for workplace-related behavior among the male-dominated tech culture in Silicon Valley.

“My advice will be: Don’t engage in this kind of behavior because the person sitting next to you or behind you or in front of you has the ability to record on video and audio what you say,” Pattison said. “If that person is offended, your behavior may not be suitable for your continued employment.”

Contact Dan Nakaso at 408-271-3648. Follow him at Twitter.com/dannakaso.