We prove a version of the Gindikin-Karpelevich formula for untwisted affine Kac-Moody groups over a local field of positive characteristic. The proof is geometric and it is based on the results of [Braverman, Finkelberg, and Gaitsgory, Uhlenbeck spaces via affine Lie algebras, Progr. Math., 244, 17-135, 2006] about intersection cohomology of certain Uhlenbeck-type moduli spaces (in fact, our proof is conditioned upon the assumption that the results of [Braverman, Finkelberg, and Gaitsgory, Uhlenbeck spaces via affine Lie algebras, Progr. Math., 244, 17-135, 2006] are valid in positive characteristic; we believe that generalizing [Braverman, Finkelberg, and Gaitsgory, Uhlenbeck spaces via affine Lie algebras, Progr. Math., 244, 17-135, 2006] to the case of positive characteristic should be essentially straightforward but we have not checked the details). In particular, we give a geometric explanation of certain combinatorial differences between finitedimensional and affine case (observed earlier by Macdonald and Cherednik), which here manifest themselves by the fact that the affine Gindikin-Karpelevich formula has an additional term compared to the finite-dimensional case. Very roughly speaking, that additional term is related to the fact that the loop group of an affine Kac-Moody group (which should be thought of as some kind of "double loop group") does not behave well from algebro-geometric point of view; however, it has a better behaved version, which has something to do with algebraic surfaces. A uniform (i.e. valid for all local fields) and unconditional (but not geometric) proof of the affine Gindikin-Karpelevich formula is going to appear in [Braverman, Kazhdan, and Patnaik, The Iwahori-Hecke algebra for an affine Kac-Moody group (in preparation)].