A Lakeville man accused of trying to kill himself and his two young sons last fall pleaded guilty Monday to attempted murder.

Jay Anthony Ernst, 28, pleaded guilty in Dakota County District Court to two counts of first-degree attempted murder in connection with the October "apparent suicide attempt that, if successful, would have resulted in the death of Ernst's two children," according to the Dakota County attorney's office.

According to the criminal complaint, Lakeville police were called to a family member's home early on Oct. 29 about an interrupted suicide attempt. The relative said she found Ernst and his 2- and 4-year-old boys in her car with the engine running. The garage door was closed and a hose was routed from the tailpipe to the vehicle's interior, according to the complaint.

The relative immediately removed the hose and pounded on the car's window.

"Ernst … got out, opened the garage door, and said goodbye, and drove away," according to the Dakota County attorney's office.

Ernst and the boys were gone by the time police arrived.

The state Bureau of Criminal Apprehension issued an Amber Alert. Within hours, Burnsville officers stopped the car on Interstate 35E about 4:30 a.m. and arrested Ernst. The children were unharmed.

Ernst had told police he didn't intend to hurt anyone and that the incident was merely a cry for help.

He will be sentenced Sept. 16 in Hastings.

Karen Zamora • 612-673-4647

Twitter: @KarenAnelZamora