The two men arrested for breaking into an Iowa courthouse last week are listed in a contract between the security firm that hired them and Iowa's Judicial Branch as "penetration testers."

Their job, according to the contract: to test the "adequacy and effectiveness" of security in place at various buildings in Iowa, including the Polk County Courthouse, the Dallas County Courthouse and the state Judicial Branch Building.

The Judicial Branch released a copy of its contract with the Coalfire security firm Wednesday, a week after the agency had issued a news release saying that state court administrators "did not intend, or anticipate, those efforts to include the forced entry into a building."

In another new development: An email written by Dallas County Sheriff Chad Leonard says that when Leonard investigated the break-in at the county courthouse in Adel, he was directed to contact a state official. The official told Leonard to release the "burglars," but the sheriff declined, he wrote in the email.

The state official was not identified in the email, which was obtained by the Des Moines Register.

Confusion over contract

Under the physical assessment guidelines in the Coalfire contract, the judicial branch gave Coalfire permission for their employees to physically enter the Judicial Branch Building, Polk County Courthouse and Dallas County Courthouse and use methods including "tail-gating," or following employees into the building, dumpster diving and picking locks to attempt a security breach.

► More:Men arrested for breaking into Dallas County Courthouse after judicial branch hires them to test 'vulnerability' of court records

The contract stipulated that law enforcement should not be notified of security tests. It also outlines that physical documents be accessed at those buildings "during the day and evening."

According to the agreement, all Coalfire penetration tests were to be conducted between 7 a.m. and 7 p.m. Monday through Friday. But tests could be carried out outside that range if requested through a change order.

The break-ins in Adel and Des Moines were investigated around midnight on separate days.

No change order was released that would have indicated the judicial branch wished the tests be carried out at night.

The contract was signed May 28 by Mark Headlee, information technology director for the judicial branch. It indicated the total fixed fees for the security operation — excluding travel — were $75,000.

Project planning began on Aug. 1, according to a schedule. The physical assessment was to begin Sept. 9 and end Sept. 13. Internal penetration tests were slotted for as late as Sept. 27.

Judicial branch employees Headlee, Andrew Shirley, and John Hoover are listed as emergency contacts in the contract.

Steve Davis, spokesman for the judicial branch, declined to comment further on the contract's terms and administrators' intent on Wednesday.

Coalfire and the Iowa Judicial Branch released a joint statement Wednesday that said they had worked together previously, “and welcomed the opportunity to work with them again.”

“Coalfire and State Court Administration believed they were in agreement regarding the physical security assessments for the locations included in the scope of work,” the statement read. “Yet, recent events have shown that Coalfire and State Court Administration had different interpretations of the scope of the agreement."

The judicial branch and Coalfire signed a master agreement on Jan. 14, 2015. They are conducting separate independent reviews of the contract.

Email shows disagreement over arrest

Leonard, the Dallas County sheriff, sent an email Sept. 12 to Sgt. Shawn Ireland at the Linn County Sheriff's Office, detailing his own recollection of what happened the night of the arrests, according to the email obtained by the Register.

Leonard requested that Ireland distribute the email to the other sheriffs across the state, Ireland confirmed to the Register on Wednesday. Leonard did not return a message seeking comment about the email.

Shortly after midnight on Sept. 11, two men were arrested after the alarm at the Dallas County Courthouse was tripped. Authorities found two men outfitted with numerous burglary tools walking around the building, according to a criminal complaint.

More:State senator says courthouse break-ins were safety liability, calls on oversight committee to investigate

Justin Wynn, of Naples, Florida, and Gary Demercurio, 43, of Seattle, Washington, each were charged with third-degree burglary and possession of burglary tools. Both have since been released on bond.

According to Leonard's email, officers who responded within three minutes of the alarms found the men manipulating doors and taking pictures of the courtrooms and building.

One man told a deputy that they were conducting a vulnerability study and handed the deputy a piece of paper, which he described as his "get out of jail free card," containing the names and contact information for three state employees, Leonard wrote.

A police sergeant called one of the state employees, who confirmed what the men said: that this was a legitimate contract and that the men should be let go, according to the email.

"I advised them that this building belonged to the taxpayers of Dallas County and the State had no authority to authorize a break-in of this building," Leonard wrote in the email.

Leonard wrote that he then called the state employee to tell him his contractors had been arrested and that he didn't have the authority to authorize this.

The state employee disagreed and asked Leonard not to tell other sheriffs, wrote Leonard, who said he responded by saying he was going to tell every sheriff.

One of the men later told Leonard that they do similar work all over the country and have had several contracts with law enforcement agencies. It usually takes a couple of calls, and then they're released, the man claimed.

"Not the case yesterday," Leonard wrote.

In the email, Leonard said he didn't know how many counties were included on the men's infiltration list. The men said they followed through on a successful operation of a state building the night before they were caught in Dallas County.

'An embarrassment for Iowa’s court system'

Matthew Lindholm, the attorney for Wynn and Demercurio, both of whom have waived their right to a preliminary hearing, said Wednesday that his clients' actions were not malicious or criminal in intent.

“What is unfortunate is they have been labeled as burglars at this point without all the information being sought and reviewed.”

The Register submitted an information request to the judicial branch on Monday, asking for copies of the contract with Coalfire.

The request was initially denied because "it includes sensitive information related to data security that could put the personal information contained in court documents at risk," a judicial branch spokesman wrote.

Randy Evans with the Iowa Freedom of Information Council submitted a letter to the judicial branch on Tuesday requesting the documents be released with the confidential security information redacted.

"The break-ins at the courthouses in Adel and Des Moines, apparently by representatives of Coalfire, have been an embarrassment for Iowa’s court system," Evans wrote. "But the embarrassment to the Iowa Judicial Branch will only increase if court administrators continue to refuse to release the Coalfire contract, along with emails and other written communications between Iowa Judicial Branch administrators and Coalfire executives."

Anna Spoerre covers crime and courts for the Des Moines Register. She can be contacted at aspoerre@dmreg.com, 515-284-8387 or on Twitter at @annaspoerre.