For pronunciation of a foreign language, do foreign speakers from a certain country speak with the same accent because they learn in their country from someone with that accent, or their native language phonology make it so that they feel comfortable speaking like that? If both are at play, most likely, what's the dominant cause?
In some cases this would likely be due to L1 transfer and differences in the markedness of features between the L1 and target language. Markedness in second language acquisition refers to a closed set of linguistics possibilities, ranked from most 'simple' and frequent in languages (unmarked) to most 'complex' and rare (marked). In most cases, a more marked form will not exist in a language without the less marked form also existing in that language. An example is voiceless and voiced stops. Voiceless stops are present in all languages to a degree, whereas only some languages have voiceless and voiced stops, and there is no language that has voiced stops only. Therefore voiced stops are consided the more marked member of the pair.
The way that this is linked to speakers of a certain L1 making similar 'mispronunciations' when learning and using an L2 is that, in general, when learning forms that are more marked in the L2 than the L1, this can cause difficulty. An example is that German learners of English have difficulty pronouncing voiced stops at the end of English words (e.g. they will pronounce 'tab' with a /p/), because in German, there are no word final voiced stops -- all word final stops are made voiceless, or devoiced. On the other hand, English learners of German usually have no trouble with the word-final stop devoicing rule of German, as they are already familiar with the more marked form via their L1. This should also apply to similar L1/L2 pairs where the L1 has the less marked phonological feature than the L2.
Of course, there are many other factors that would contribute to someone's accent, but this would account for some of the common 'mispronunciations' at least. But yes, in most cases the native language phonology would account for the L2 accent more than the accent of those who the L2 is learnt from.
Source: Ortega, L. 2009. Understanding second language acquisition. Routledge. pp. 37-38.