Under threat of a lawsuit from the U.S. Department of Justice, the state Department of Motor Vehicles and the Secretary of State agreed to come up with a plan to automatically register drivers to vote when they go to the DMV.

Under the current program, which according to the federal government violates the National Voter Registration Act of 1993, a customer is registered to vote only if he or she chooses that option.

A federal investigation found that Connecticut’s Department of Motor Vehicles was failing a majority of the time to offer voters a chance to register when they applied for driver’s licenses or state-issued identification cards.

The DMV and Secretary of the State Denise Merrill agreed Tuesday to come up with an innovative new system that would automatically process the voter registration. The plan will take two years to develop, according to the timeline laid out in the memorandum of understanding.

A legislative proposal that called for similar measures died earlier this month when the General Assembly adjourned, but DMV Commissioner Michael Byzdra and Merrill agreed to work together to come up with a system to automatically register drivers to vote. That makes Connecticut the fifth state to adopt automatic voter registration and the first to entirely bypass the legislative process in order to implement it, according to advocates who track automatic voter registration nationally.

“We are very pleased with this agreement knowing that it will help bring more voters on the rolls in Connecticut,” Bzdyra said in a statement. “We are eager to work with Secretary of the State Merrill and her team on making us a state at the forefront helping every eligible citizen register to vote.”

Merrill called it a “monumental event enhancing voting rights and opportunity in Connecticut, and a continuation of our rigorous efforts to bring new voters onto the rolls. This agreement also puts Connecticut alongside a vanguard of states that are leading the nation in the movement to register every eligible citizen.”

The two agencies have until October to appoint members of their staff to oversee the project.

It is estimated that 400,000 eligible Connecticut citizens will be added to the voter rolls through automatic voter registration.

According to iVote, a national voting rights organization, Connecticut and four other states have now enacted automatic voter registration — including Oregon, Vermont, California, and West Virginia. Twenty-eight states and the District of Columbia have considered AVR bills in 2016.