Hungary 's prime minister stunned the country by announcing his resignation , saying he had become an " obstacle " to the reforms needed to pull the nation out of its worst financial crisis since the end of communism nearly 20 years ago .