Standalone (exclamation of disbelief):
まさか + clause + とは思わなかった / とは思いませんでした
まさか + clause + ないだろう / まい / はずがない
まさか + clause + わけがない
まさか + clause + なんて
まさか is an adverb used to express strong disbelief, surprise, or the feeling that something is impossible or completely unexpected. It conveys the sense of "no way," "surely not," "I can't believe," or "I never dreamed that…"
まさか can be used on its own as an exclamation to express shock or disbelief when hearing something unexpected.
Combined with とはおもわなかった思わなかった or とはおもいませんでした思いませんでした, まさか expresses that something was completely beyond one's expectations.
When paired with a negative predicate and だろう or でしょう, まさか expresses the speaker's belief that something is highly unlikely or impossible.
Combined with わけがない, まさか strongly emphasizes impossibility.
まさか inherently carries a tone of surprise or emotional reaction. It is used when the speaker encounters – or imagines – a situation that defies their expectations. It can appear in both casual and polite speech. When used at the start of a sentence with a questioning tone, it often implies "Don't tell me that…" or "It can't be that…"