ATHENS — Five volunteers for European aid groups who worked in Greece at the height of the migrant crisis were cleared of charges of illegally bringing migrants into the country by a Greek court on the Aegean island of Lesbos on Monday.

The case had been closely watched by migrant relief and rescue groups, especially in Denmark and Spain, where the volunteers were from, because their defense lawyers and supporters said it was an attempt to criminalize humanitarian action.

The issue has taken on broad importance across Europe and especially in the Mediterranean as the migrant crisis has continued, if at a lower level than when the defendants in Greece volunteered two years ago. The political divisions stoked by migration have left the line between humanitarian intervention and criminal interaction increasingly treacherous to navigate in many countries for nongovernmental organizations, or NGOs.

“This is a strong signal to other NGOs and just people working for humanity,” said one of the Danish defendants, Salam Aldeen, the founder of Team Humanity, speaking by telephone after the verdict. “Saving lives is not a crime, rescuing people is not a crime.”