A southwest Missouri man who was found dead with his two young children after a nearly-24 hour standoff had been working out a custody plan with his soon-to-be ex-wife, an attorney said Tuesday.

City police officers found the bodies of William R. Williams, 51, his 4-year-old son, Brodie, and 2-year-old daughter, Marley, in their Springfield apartment Monday night after the standoff that began Sunday.

Williams apparently died of a self-inflicted gunshot wound, police said in a statement. The cause of the children's deaths has not been released.

No one else was inside the home.

Online court records show Williams filed for divorce from Brittnee Williams in March 2014, but the case was dismissed in the summer. Williams refiled in November and the case was pending.

Williams' divorce attorney, Jason Shaffer, said in a statement that the couple had negotiated and approved a parenting and custody plan for the children and that William Williams never indicated he was dissatisfied with the agreement. The couple was scheduled to attend a parenting class Thursday, as required before a marriage involving children can be dissolved, Shaffer said.

"My heart is broken by the loss of life," Shaffer said.

The standoff began when police responded around 9:30 p.m. Sunday to a "check person" call at the apartment on the southwest side of town, according to the statement. Officers encountered an armed man and set up a perimeter. Negotiations continued throughout the day.

Police Lt. Eric Reece said at a news conference that the bomb squad deployed robots to ensure safety before officers stormed the apartment.

Police spokeswoman Lisa Cox said officers finished working at the apartment Tuesday morning but released no other information.

Williams worked as a civilian for the Missouri State Highway Patrol between 1988 and 1991, said patrol spokesman Jason Pace, who could not provide any other details. Springfield media reported that relatives and friends said Williams currently was working for CST, or Communications Solutions Technologies.