Foreign income: When to include in filing? year earned or year remitted to US

I am based in US, but earned some foreign income as a side gig that is deposited into the local bank. I am not allowed to transfer the income back to US without paying taxes in the foreign country.  So when do i recognize the income in US return? The year i actually earn it, or the year i finally transfer to US after paying foreign tax. It may take more than a year to file the foreign tax return, and remit whatever is left back to the US.