Erdogan did not rule out the involvement of "foreign countries" in the attempted coup and declares a state of emergency