Nassau and Suffolk police said Wednesday said they are taking enhanced security measures to protect their officers and residents after two police officers were fatally shot in separate ambush-style attacks in Iowa.

Both departments and the NYPD offered condolences to the families and colleagues of the slain officers.

In statements released Wednesday morning, the three departments said they were aware of the Iowa shootings and monitoring the situation.

Nassau said it was intensifying patrols near public gatherings as well as taking other security measures.

Suffolk County’s statement said there is no credible threat in the county but “out of an abundance of caution, the department will continue to implement enhanced measures to ensure officer safety.”

Nassau County said it taking “all steps necessary to ensure the safety of the public and its police officers.”

Patrols will be intensified in areas of public gatherings and near critical infrastructure, and social media outlets also will be monitored, Nassau police said.

Both departments also said they were in contact with their regional law-enforcement partners, including local and federal authorities.

The NYPD also offered condolences on its Twitter account.

advertisement | advertise on newsday

“Our prayers are with the families and colleagues of the officers killed in the line of duty in the Des Moines area of Iowa. #NeverForget.”

Just after the Wednesday morning tweet, the NYPD released a statement saying, “We are aware of the situation and will continue to monitor the situation as well as any developments.”

Authorities said two police officers from the Des Moines area were shot to death in ambush-style attacks about 2 miles apart.

Officers responding to a report of shots fired at about 1:06 a.m. Tuesday found an Urbandale Police Department officer who had been shot.

Des Moines officers responded to help. About 20 minutes later, a Des Moines officer was found shot about 2 miles away. Both officers have died.

Both officers were sitting in their patrol cars when they were ambushed, police said.

Urbandale is a city in the Des Moines metro area.

With The Associated Press