TAYLOR, Mich. – A Michigan Court of Appeals upheld a lower court decision Wednesday that struck down a deal between the Taylor school district and teachers union that attempted to circumvent the state’s right-to-work law.

The district agreed to a new contract with the Taylor Federation of Teachers in 2013 – weeks before the state’s right-to-work law took effect – that included a 10-year “union security clause” that forced teachers to continue to pay union dues or face termination.

MORE NEWS: Know These Before Moving From Cyprus To The UK

The right-to-work law prevents employers from requiring union membership as a condition of employment, but the TFT negotiated a pay cut for members to lock in the required union dues until 2023.

The Republican controlled Michigan Employment Relations Commission decided in 2015 that the agreement was not legal, and the case eventually made its way to the Michigan Court of Appeals.

“In a 2-1 decision Wednesday, the court says it’s reasonable to believe that the Taylor Federation of Teachers ‘took deliberate action’ to try to lock in union dues and membership for a long period before the law kicked in,” the Associated Press reports.

The Taylor school district wasn’t the only one in Michigan to attempt to side-step the law.

In Wyoming Public Schools, district officials and the Kent County Education Association entered into a similar agreement that traded $12,7000 in annual salary for school employees to lock in mandatory union dues and fees, despite the fact that the agreement was unenforceable because it did not take effect until after right-to-work became law, EAGnews reports.

“This clearly shows that the union doesn’t care what is best for the teachers but what is best for the union,” Audrey Spalding, education policy director for the Mackinac Center, said at the time. “They gave up thousands of dollars per employee for unenforceable language.”

MORE NEWS: How to prepare for face-to-face classes

In Wyoming schools, officials later refused to fire a school bus driver who defied the agreement and refused to pay union dues, essentially snubbing the KCEA.