A nearly 14-hour standoff on a ranch in North Dakota ended Saturday with the arrest of two men who escaped from a rural Alabama prison more than 1,200 miles away, a federal law enforcement official said.

Joshua Southwick, 26, and Ashton Mink, 22, were apprehended following two shootouts with North Dakota law enforcement, nearly two weeks after their brazen escape from the Perry County Detention Center in Uniontown, Ala.

Also taken into custody were two women authorities said helped the men escape, Angela Diana Mink, 25, and Jacquelin Rae Kennamer Mink, 25, Mink's sister and wife.

The four had eluded law enforcement in at least seven states until a robbery at a video store in North Dakota around midnight Friday. The fugitives, who are suspected of the robbery, fled the scene and then holed up in an outbuilding on a ranch in Dickinson, N.D., said the law enforcement official, who requested anonymity because he wasn't authorized to discuss the matter.

Officers exchanged shots with the suspects as they drove away from the video store, but law enforcement lost them.

Around 12:45 a.m., a rancher contacted law enforcement to say some people had run into one of his buildings, the official said. Law enforcement including local SWAT teams surrounded the building, which was about 100 miles west of Bismarck.

Around 2:25 p.m. Saturday, as law enforcement prepared to use tear gas on the building, Southwick and Angela Mink walked out and were taken into custody, the official said.

At the same time, Ashton and Jacquelin Mink ran out the back of the building as Ashton Mink fired a gun at law enforcement officers. Police returned fire and hit Ashton Mink, the official said. Jacquelin Mink was also hit, but it was not immediately clear whether it was self-inflicted or a result of police fire.

Neither Ashton nor Jacquelin Mink was fatally injured and both were taken to area hospitals. Their conditions were not immediately known.

Stark County Sheriff Clarence Tuhy confirmed a standoff with Alabama fugitives had ended but said he didn't have the names of the suspects.

The saga began on May 25 when the women hid in the woods outside the prison during a storm and cut the electric fence before dawn, apparently counting on the alarm being ignored, authorities said.

To escape, Southwick and Ashton Mink changed into a pair of uniforms normally worn by kitchen workers. They were then mistakenly allowed outside the prison by a worker who thought they were kitchen trusties, said Richard Harbison, executive vice president of prison operator LCS Corrections Services Inc. of Lafayette, La.

It's unclear how the two got the uniforms or why the women were confident that guards would ignore the alarms that would be triggered by cutting the power lines. Seven employees at the privately owned lockup were fired for allegedly committing a string of blunders that allowed the scheme to work.

Southwick had pleaded guilty to murder and burglary in a slaying in Alabama's Limestone County six years ago, and Mink was serving time for attempted murder after being accused of stabbing a man during a home invasion in Huntsville.

Both women were charged with aiding in the escape before the standoff occurred. A call to the local prosecutor in North Dakota rang unanswered.