The U.S. military is creating an electrical code for U.S. facilities in Iraq as part of an effort to prevent future electrocutions in Iraq. The deaths of at least 18 U.S. service members and contractors in Iraq are under investigation as possible electrocutions.

The code is being created by certified electricians hired by the U.S. Army Corps of Engineers, Gen. David Petraeus wrote in a letter to Sen. Bob Casey, D-Pa. Petraeus wrote the letter in early September to Casey before he stepped aside as top commander in Iraq to be commander of U.S Central Command.

Casey's office released a copy of the letter Tuesday.

The letter also spells out other actions taken to prevent electrocutions, such as creation of a media campaign to educate soldiers about working with electricity. Petraeus said 86,000 facilities are being inspected, and it will be next year before all repairs and improvements are made.

Petraeus added, "All leaders understand the urgency of completing the required actions."

One of the soldiers killed was Green Beret Sgt. Ryan Maseth of Pittsburgh, who was electrocuted in January while showering in his barracks in Iraq. That prompted inquiries on Capitol Hill about the electrical work done by contractors in Iraq charged with maintaining facilities used by U.S. troops.

Many of the electrical deaths have been deemed accidents because they involved situations such as coming into contact with power lines. But others have occurred when individuals were repairing air conditioning units, doing generator maintenance or using a shower.

In a statement, Casey praised the changes, but said he'd like them to be implemented in Afghanistan as well.

"While these measures represent a significant step, the Congress must continue to exercise strong oversight to ensure these steps are carried out," Casey said.