From 1991 until 2004, Luis Patino was routinely called derogatory names based on his sexual orientation on a Bloomfield factory floor.

Despite numerous letters and official complaints, the company — Birken Manufacturing — failed, according to court documents, to correct this hostile work environment.

Now it’s going to the cost the company $94,500.

In a decision released Friday, the Connecticut Supreme Court upheld a lower court ruling that says employers have a duty to create a safe work environment for employees who are discriminated against on the basis of sexual orientation.

Ending a saga that began more than 20 years ago, the court upheld a jury trial ruling that awarded $94,500 to Patino, who is now 72.

Legal experts are saying that this is one of the first times that a state supreme court has directly addressed the issue of discrimination in the workplace based on sexual identity.

The ruling, which found the trial court “did not abuse its discretion when it concluded the award was not excessive or shocking,” also sets something of a precedent, experts are saying, with regard to the amount of damages being paid for purely psychological damage.

Here’s how the story goes.

Patino, of Enfield, worked at Birken Manufacturing from 1977 to 2004 as a machinist. In 1991, Patino says he started getting called derogatory names referring to his sexuality. The abuse, according to Patino’s testimony, would happen several times a day. He would shake with anger and lose sleep over it.

After years of the abuse, Patino began to complain to his supervisor. The supervisor held a meeting with one of the offenders, and after nothing changed, transferred the offender to a different facility. But the abuse didn’t stop. So in 1995, Patino got a lawyer to send a letter to Gary Greenberg, then the company’s vice president.

Greenberg suggested that Patino be evaluated by a psychologist, because it was dangerous to operate precision machinery while his “mental facilities were compromised,” the court’s summary reads.

For the next eight years until 2004, Patino wrote letters describing his harassment to his bosses, as well as filing five complaints with the Connecticut Commission on Human Rights and Opportunities.

In the fifth complaint Patino argued that the company was violating Connecticut statute by “failing to take adequate measures to alleviate the harassment or to remedy the hostile work environment.”

A jury found in Patino’s favor and awarded him $94,500 in damages.

An appeal by the company sent the case to the state Supreme Court where it unanimously upheld the jury’s original ruling Friday.

In a statement, released through his lawyer Friday afternoon, Patino said that he was determined to see the trial through to the end.

“This type of discrimination happens to gay people everywhere, every day. I am aware that some victims have committed suicide because of this hostile treatment,” he wrote.

The decision, wrote Patino, “means that employers must take seriously these complaints and these situations, or face the consequences.”

Greenberg, now the president of the Birken, issued a statement saying he was “disappointed” with the court’s ruling, and that the company will “continue to diligently work to protect our employees against discrimination.”

Jon Schoenhorn, Patino’s lawyer, said that the ruling is “putting employers on notice that they have a duty to stop locker room behavior.”

The case is significant because it is one of the first instances in which a state Supreme Court ruled that sexual identity can be protected in employment discrimination the same as race or gender, referring to anti-discrimination statutes from the early 1960s.

Jon Bauer, a clinical law professor at the University of Connecticut who teaches a class on employment discrimination, said that the court’s decision “sets a clear precedent” in terms of establishing that employment discrimination law can apply to sexual orientation.

The other important facet of the ruling, according to legal experts, is that the supreme court affirmed the decision to award monetary damages to the plaintiff for psychological pain.

The ruling, according Attorney Charles Krich of the Commission on Human Rights and Opportunities, shows that “these types of indignities are worth real money,” he said, referring to the slurs Patino endured at work.

Connecticut is one of 20 states, as well as the District of Columbia, with laws on the books making workplace discrimination based on sexual orientation illegal.

Thomas Ude, Jr. , a senior staff attorney at Lambda Legal — a national organization active in LGBT discrimination issues — filed an amicus brief in the case. In a phone interview, Ude said that this “is the first state supreme court that I’m aware of that has been called upon to address this issue.”

“We’re very pleased to see that the Connecticut Supreme Court remains consistent with other anti-discrimination laws,” he said. “In far too many states it’s completely legal to fire someone or refuse to promote them or to allow them to be harassed because of their sexual orientation.”