Nelson worked for James Knight in 1999 and stayed for more than 10 years at the Fort Dodge business.

Toward the end of her employment, Knight complained to Nelson her clothing was tight and "distracting," the court said in its first ruling. Nelson denied her clothes were inappropriate.

At one point, Knight told Nelson that "if she saw his pants bulging, she would know her clothing was too revealing."

At another point, in response to an alleged comment Nelson made about the infrequency of her sex life, Knight responded: [T]hat's like having a Lamborghini in the garage and never driving it."

Knight would occasionally ask Nelson to wear a lab coat, the court said in its Friday ruling.

During the last six months of Nelson's employment, Nelson and Knight, both married with children, started sending text messages to each other outside of work. Neither objected to the texting.

Knight's wife, who was employed at the same dental office, found out about those messages in late 2009 and demanded he fire Nelson.

In early 2010, he did just that. In the presence of a pastor, Knight told Nelson she had become a "detriment" to his family and that for the sakes of both their families, they should no longer work together, the court said. Knight gave Nelson one month's severance.

Justice Edward Mansfield wrote Friday that the court, in reconsidering the case, found that the firing of Nelson "did not amount to unlawful discrimination."

He said that Nelson's arguments warranted serious consideration, but the court found a distinction between an employment decision based on personal relations and one based on gender itself.

"In the former case, the decision is driven entirely by individual feelings and emotions regarding a specific person," said Mansfield. "Such a decision is not gender-based, nor is it based on factors that might be a proxy for gender."

"While the loss of a job is often devastating to an employee, and at times unfair, these considerations do not play a role under our employment-at-will doctrine, and our exceptions to this law, such as sex discrimination, are only based on the underlying discriminatory motivation of the decision maker," said Mansfield.

Knight told Nelson she was his best assistant, according to the court. The dentist then hired another female assistant.

Nelson did not contend her employer committed sexual harassment.

Paige Fiedler, Nelson's attorney, criticized Friday's ruling.

"Up until now, courts were the only thing standing in the way of employers like Knight getting away with violating the civil rights of their employees," Fiedler said in a statement. "Now men can protect themselves from sexual harassment claims simply by firing women they've been harassing."

After the court's initial ruling in December, Knight's attorney said a ruling against his client would "ignore every other case we could find" with similar facts.

"He and his wife really agonized about it," Stuart Cochrane said about Knight's decision to fire Nelson. "He didn't want to terminate her."

Chief Justice Mark Cady, in a concurring opinion Friday, said Knight and Nelson developed a consensual personal relationship.

"It is undisputed that this relationship extended well beyond the workplace. Nelson and Dr. Knight communicated with each other outside the workplace on matters extraneous to the employment. Their relationship was personal and closer than the relationships Dr. Knight maintained with the other employees," Cady argued.